You can add items to lists.

history = []
action = input("Action: ")
history.append(action)
print(history)

You can also remove the last time from the list.

undone = history.pop()
print(f"Undone: {undone}")

You can clear a list.

history.clear()