Dear all, i'm writing a certain script which does a specific task in a repetitive manner, i'm going to give a similar script with the same concept hope you could advise me to a better way: