Using Undo and Repeat
Notice the small list arrow next to the Undo button.
When you click it, a list of the separate actions you have performed appears. If you don't see the action, scroll through the list. You can click and drag to select as many actions as you want to undo.
You cannot choose to undo one action in the middle of the list. To undo something you did several steps back, you will have to undo everything you did after that action.
If you only want to undo one action in the middle of your document, select it and delete it or type the corrected text over it.