It might be easier to just /play the file

on *:text:!commands:#: {
if ($file(commands.txt)) { .play # commands.txt 2000 }
}
.play # commands.txt
2000play msgs the file contents one line at a time.
The
2000 refers to milliseconds delay between each line (2000 ms = 2 seconds), you can change that as you wish.
For more options, see "
/help /play" (especially the second option that pops up when typing that).