In your case instead of the for each you could use:
+ System: Pick Box instance (LoopIndex("y")-1)+(LoopIndex("x")-1)×5
It would be easier if you would use zero-based numbering an the x and y loop in the correct order.
+ System: On start of layout
-> Box: Destroy
----+ System: For "y" from 0 to 4
----+ System: For "x" from 0 to 4
-----> System: Create object Box on layer 0 at (LoopIndex("x")×100+200, LoopIndex("y")×100+200)
+ Keyboard: On Space pressed
+ System: For "y" from 0 to 4
+ System: For "x" from 0 to 4
----+ System: Pick Box instance LoopIndex("x")+LoopIndex("y")×5
-----> Box: Set values to LoopIndex("x")