You need, when quitting the layout, to somehow keep in memory the state/position and any relevant informations for the objects in the current layout.
And you need, on start of layout to check if this is the first execution of the layout or if the layout has already been executed, in which case you do apply the saved informations to the current "scene".
The persist behavior can indeed help with that, be sure to consult its manual article to know exactly how to apply it.
Otherwise, to manually save data, you can use data structures like arrays to keep in memory the several informations.
To know what informations to save, this completely depends on your project and what you are trying to achieve, which is, as LittleStain explain, unknown to us because of a lack of capx or even clear/detailed explanations.