How to Stack Static Meshes with Different Heights on Top of Each Other using for each loop?

Hi I want to create a tool within Editor Utility Widget that stacks selected meshes on top of each other how would I do this?