need help to modify this push button code

At the moment the code simply reads the buttons and prints a message to indicate which one has been pressed. The program has no way of knowing what level of the menu is currently on the screen and what action to take when a button is pressed. What you need to do is implement a state machine with a variable, lets call it state, whose value is changed when a button is pressed so that next time a button is pressed the appropriate action for the current state is taken.

So, in your example you could start with state set to 1 and display the top level menu. If button 1 is pressed you update state to 2 and display the Add Fingerprint menu and wait for a button press. When a button is pressed you check the current state and respond appropriately for that button in that state. For instance, suppose button 5 is designated to exit from the Add Fingerprint menu and it is pressed. You would update state to 1 and display the top level menu ready for another menu item to be selected.