Permission denied editing .txt file

sudo nano file.txt should work, but as Dorota said if the file isn’t writable then you won’t be able to save it.
Something like ls -l file.txt will print out it’s permissions.