Allow m3u files to be edited in TextEdit, saved, and used without a "is damaged and can't be opened" message
.m3u files are really nothing more than just basic plain text files. My guess is that you're getting this issue because TextEdit is not currently set to use plain text as its format.

You don't specify what version of macOS you're running, but in the more recent versions of TextEdit you can change how it deals with file formats by default.

Change the default TextEdit format

You can change the default TextEdit format as follows:


Launch TextEdit
Go to TextEdit > Preferences... (or just use the command, shortcut)
Ensure you have the New Document tab
At the top you'll see three options for Format. Select the Plain text option.
Exit preferences


Now when you edit an existing .m3u file (i.e. it already has the .m3u extension) then it should be fine.

If you create a new file, be it a .m3u file or one in another format, you will need to manually add the extension to the filename when you save it. If not, it will default to the Plain Text extension (i.e. .txt) instead. You can also change this behaviour in Preferences by going into the Open and Save tab and unticking the checkbox for Add ".txt" extension to plain text files.