Do you only can't save a .txt file to the desktop? If yes, you can try to save the .txt file to another destination like the Documents folder in Finder, and then move it to the desktop.
It seems that your TextEdit is not working properly on your Mac. Here are some tips:
1. Re-create the TextEdit PLIST file
The PLIST file is the program properties and configuration file. When the application doesn't work normally, you can re-create its PLIST file.
- Open Finder, Go > Go to Folder.
- Enter ~/Library/Preferences/com.apple.TextEdit.plist and press Enter to locate the file.
- Move the file to the Trash.
- Reboot your Mac to let the TextEdit PLIST file be re-created by itself.
2. Update your Mac
Maybe it's a bug in your current system that makes TextEdit won't allow you to save a .txt file. So, when a new minor version is available, update your Mac.