which trigger did you use ?
step 4 triggers the layout's trigger all over again.
You can set a global variable and use its value to control whether the trigger performs a script or just exits.
Put this at the beginning of your script:
If [Not $$TriggersOff]
Set Variable [$$TriggersOff ; True]
// Put your curent script steps here
Set Variable [$$TriggersOff ; False]
That will keep your script trigger controlled script from endlessly performing itself.