Apart from the valid points mentioned in this thread, you don't really need a loop here: you can use $read()'s w switch, to have mirc search the file itself for lines matching textstring:* (type /help $read for more)
Code:
on 1:TEXT:!test1:#:{
  noop $read(file.txt,w,textstring:*)
  msg # $readn
}