OK, you still need a return on ‘output’, but you don’t even need to define an output variable. Just do a return on the function call.
You still need to convert your array to a string.
Replace this:
return schedule;
With this
return schedule.join(',');