You weren't far off. This just uses a WHILE loop instead of a GOTO loop. Also, in either loop, your channel token (%chans in your script or the $gettok() in mine) needs to be within the loop so that it gets updated with each loop. In yours, you put it before the loop started, so it wouldn't be changed and you'd just keep echoing in the same channel.