I see that output 2 has the duplicate record where
the column 6 value 213 is less than 345 except that value
is a later line not a previous line.
To compare the value of previous and later lines you either have to
scan the file twice or read all the lines into a structure
and then create the output files.