hi!
it seems the problem is how your loops are generating the rows
in your first each you are generating: R2, R3 ... R6
the second each you are generating: R2, R3 ... R7
the third each you generate: R2, R3, R4
basically you are generating duplicated rows, and because of that when you see the file, the preview tries to self-repair the duplicated rows by given them new indexes, so that is why you your content being generated at different rows.
there are a lots of ways you can fix this, but the most simple i think is to group your data and in single loop generate all the rows that you need