Declare a byte array big enough to hold the total number of button presses expected and an index variable to point at the next array entry to be used.
byte arrayIndex = 0;
Each time a button is pressed save the button number to the next array entry and increment the index variable and put a marker in the array to indicate where the end of the sequence is.
if (digitalRead(button1) == LOW)
buttonPresses[arrayIndex] = 1;
buttonPresses[arrayIndex] = 99;
Do the same for the other two buttons, storing 2 or 3 as appropriate.
When the fourth button is pressed you can replay the sequence of stored numbers
arrayIndex = 0;
while (buttonPresses[arrayIndex] != 99)
There is still work for you to do to check the stored numbers as they are read from the array and to do whatever you want depending on the number but I suggest that you start by simply printing the numbers as above.