@alto777’s suggestion makes this easier. Just storing the button-called state for each up and down button automatically stores that information for you. The lights on the elevator buttons are all there for more than informing the users that the elevator is on the way—they are integral to the planning: If you are going down and reach a floor with a lit down button, stop and service it.
You need to plan ahead for adaptability (state machines, non-blocking, millis() not delay), because adding in intelligence to a some bare minimum code will be difficult.
Show your code. Or read these and start fresh: