4 pushbutton lock coding [SOLVED]

What you are forgetting is that the loop goes very fast, it does not wait for you to finish pressing a button. So you have to write code that once it detects a push button it will wait until the button is unpushed. It then has to look for the next button and if it is not the correct button it has to reset the variable keeping track of what is the next correct button.
Look up what a state machine is all about.