Well again it needs to be much simpler than what you have, you don't need so many loops and you don't need variables to track next available x and y. Also be careful using loopindex("x") as the x is for the name of the loop which you don't have.
You need a simple system 'for' loop, for from 0 to array.width. This runs down all the rows. Then with this the condition array.at(loopindex,0) = 0. Then on the right side actions, you have Stop loop, and set the other columns to what you want so for example set array.at(loopindex,1) to an item name, array.at(loopindex,2) to an item description.
So yeah that's all you need to set up what you want I dunno how I can make it clearer than this :D
Also you never posted what the array looks like but make sure the empty slots are actually 0 and not just lacking any value so it would be "" instead of 0 if that's the case.