To deal with superfluous carriage returns in TextEdit
I don't believe that TextEdit has such an option.  It happily accepts all line ending types (even intermixed within the same file) and displays them properly.

You would probably need to use a text editor where you have direct control over the line endings and text encoding type when saving the file.  BBEdit is a great text editor that has such controls.

Another option is to convert the file with a utility like dos2unix.  The website doesn't offer a macOS binary download so you would need to either compile it yourself or install a package manager like Homebrew first then install the dos2unix package with brew install dos2unix. For an easy solution you can just run perl -pi -e 's/\r\n/\n/;' FILE.TXT as well.