how to switch off led in Loop

With no comments in your code, it is very difficult to say what the problem is.