Undo and Repeat
Notice the small list arrow next to the Undo button. When you click it, you'll see a list of all the separate actions you have performed on the document you are working on. You can select as many actions as you want to undo.
You cannot choose to undo one action in the middle of the list. If you want 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, highlight it and delete it or type the corrected text over it.