Sorry, I made 2 errors:

1. I was using syntax to count lines in a @window instead of lines in a text file. The $calc($line(list.txt,0)) should be edited to instead be

$calc($lines(list.txt))


2. In the !next event I should not have used the 'w' switch, causing it to look for the number 1 instead of looking for line 1. Remove the w from $read(list.txt,ntw,%line) to change it to $read(list.txt,nt,%line)