in reply to Group every 50 rows
Set up a counter equal to zero (say...) outside the loop, then increment it each time. After incrementing it (so that the initial value is 1...), test to see if “counter modulo 50” is equal to zero. As all of the above examples do. If so, print a newline or two.
Modulo, of course, is the remainder obtained from a division operation. When zero, you know that the counter is now some multiple of (say) 50.