You can choose that Text Editor maintains a file containing the previously saved version of a file each time it performs a save. You do this using the Backup on Save menu item on the Options menu. The default setting is un-selected, so each time you run Text Editor, the setting reverts to the default.
When performing a save with Backup on Save selected, Text Editor first copys the original file to a new file name (the old file name with a percent character "%" appended), and then saves the edited file to the original file name.
You can revert to the previously saved version of a file in which you are interested as follows:
Choose Open from the File menu.
Text Editor displays the Open a File dialog.
Browse to the folder containing the file in which you are interested, and select the corresponding file name with a percent character "%" appended.
Text Editor opens the file.
Use the Save As command in the file menu to overwrite the original file.
The original file now contains the contents of the previous version.