Welcome to the forum.
It is pretty hard from the screen shot to understand how the squares are placed in 3D space.
It would help a lot to have the .shapr project or more views.
Short answer to your problem is probably guide loft, but if you can share more information, I can probably help you.