It looks like you are reading the entire file at once so the loop is pointless. You may in fact need to write a line at a time with each line terminated correctly or each command. In either case, you want to read the file once and create a string array that is indexed by s for loop.
↧