You're not specifying the name of the file. You need something like :
BE_ExportFieldContents ( field ; $folderPath & "/" & $filename )
I had $folderPath when I wanted $filePath (line 14 in the script). I did notice that prepending the path with "filemac:" doesn't work, so I dropped that and it works as expected.