In group by node in each loop iteration you need different Row. So first time it is Row0, then Row1, Row2…
You will get this by controlling aggregation column name with flow variable. When you use this loop there is automatically created flow variable currentColumnName with name of current column in loop. Use it.
In Rule engine node if you use TRUE => 1 you will add (or replace depending on node configuration) column with all 1s. This way you can use TRUE => “flow variable name” that holds number of rows.