How to make a button stay on?

A switch is an input device. You can't make it be pressed.

What you do is write the code so that, once the state of the switch is determined to be pressed, you no longer care about what the state of that switch is/was/will be.

You'll be in a world of hurt if you ever decide that your pin code should be 3412, instead of 1234, with the code that you have now.