By reading from
<FILE> in the inner loop, you exhaust the file handle. It doesn't remember where it last read to $line1 and doesn't automagically review the file back.
So, the outer loop only reads the very first line; in the next iteration, it sees the end of file.