Please How to use code fences.
Do not use a reserved word for Item names. You cannot have an Item named “Switch”
As Alessio indicates, if you want the switch to control more than one light you don’t need any complicated loops or timing. Just put the lights into a Group and write a simple Rule that forwards the command sent to the light switch Item to the Group.