So you want to create cube, and has it move to new spot each time you press a button, am I correct? If that's the case, this is not a loop thing. It's a 1 time function that executes as you press the button. You'll need to find a way to store the location so that you can add to it each time the function is called. Here's…
Your button would need to call a function instead of having a command embed. I'm sorry I haven't script in MEL for a very long time so I won't be able to cook you any examples. I can only give you the idea.