Here's a fixed version:
(Note: This doesn't work if the audio file has an & in its name. See page 2.)
@NOFILENAMEQUOTING
@RUNMODE HIDE
Select PATTERN *.(mp3|ogg|flac|aac|wma) DESELECTNOMATCH
Echo #EXTM3U>"{sourcepath$|nopath|noterm}.m3u"
Echo {file$}>>"{sourcepath$|nopath|noterm}.m3u"
<?xml version="1.0"?>
<button display="both">
<label>Create M3U</label>
<icon1>48</icon1>
<function type="batch">
<instruction>@NOFILENAMEQUOTING</instruction>
<instruction>@RUNMODE HIDE</instruction>
<instruction>Select PATTERN *.(mp3|ogg|flac|aac|wma) DESELECTNOMATCH</instruction>
<instruction>Echo #EXTM3U>"{sourcepath$|nopath|noterm}.m3u"</instruction>
<instruction>Echo {file$}>>"{sourcepath$|nopath|noterm}.m3u"</instruction>
</function>
</button>
The important change is the extra |noterm on the last two lines which stops the \ being added to the end of the folder path.
The original button was trying to write to FolderName.m3u instead of FolderName.m3u
Just for neatness, I also removed the two sync: prefixes as they're not needed anymore (but they were harmless) and put a @ before the RUNMODE HIDE (but that was harmless too).