What you have shown (ignoring the bugs - there are some) is a solution to a different problem than the one you initially asked for help with! To avoid wasting our time helping you solve a problem that doesn't actually help you, what are you really trying to do?
The short answer to "if so what?" is that your inner loop runs to the end of its file so the second time through the outer loop there is nothing left for the inner loop to loop over. However the code you show is bad in too many ways for me to bother with until I know I'm not wasting my time solving non-problems aside from saying "don't nest loops that read from files - it's almost always wrong".
True laziness is hard work