While loop script is not working

Thank you everyone for the expeditious help! I realize it is not a good method... but I figured (before, in my head) it was the easiest to implement. There are 5 lines that make up one production machine. Each one of the five lines has about 17 tags (with machine signals) attached to them.

My main goal is to show the aggregate error outputs for the 5 lines in 1 hour (continuous) intervals. I have as shown in the second image of the post, 24 labels for "scrap" in this case. I didn't want to create 24 tags x 2 (scrap and good parts) + (possibly other tags ). I thought I could just use the labels directly as temporary "memory cells" for the counters

Maybe on my previous post, I explain a bi more in detail what I wanted to do: