How to make a lift between two floors?

What you are creating is a type of Finite State Machine.
you need variables to keep track of which floor the elevator is on, which one is calling it to come, and whether it has reached its target floor and whether the doors are opened, closed, etc.