@iamRahul I figured it out. We need to specify full location path till the file, and specify file type in format. Then it worked for me.
if(audioPlaylist.save("file:///C:/MyMusicPlayer/Playlists/global_playlist.m3u","m3u")) {
console.log("Playlist Saved")
}
Adding the filename global_playlist.m3u and format m3u made it working for me.