That doesn't fully explain it but I think I got it, each line is overwritten with what it's place on the 300th line after.
Something like
readLineOffset = 301
writeLineOffset = 1
While not read eof
line = Read(readLineOffset)
Write(WriteLineOffset, line)
readLineOffset ++
writeLineOffset ++