Code help needed for project

Yea. The issue is different. even if the switch pin is off the loop continues.
Thanks