The feedback node near the center of your diagram is not initialized, thus data from earlier runs are forming a buildup.
The issue is complicated because you have a FOR loop inside a while loop. An initialized feedback node does not work well if you have stacked loops. You need to replace it with a shift register and add another shift register on the WHILE loop. Now you need to initialize the lefmost shift register at the WHILE loop boundary with an empty array. (see attached, LV7.1)
I don't have the luxury of 2000x2000 monitor resolution, thus I compacted your diagram a little bit. My work slows down if I constantly have to scroll.
😉Do you really want the result file to be numbered "n", while the input file is numbered "n+1"? This seems confu
sing. I modified a few codelets, e.g. your method to get the number of rows seems overly complex. I'm pretty sure your loops could be simplified too, but I did not bother to investigate.