The top example is the correct way of doing it. The file will not be in the same directory as FileMaker, as you are telling it to use the TemporaryPath, which is a temporary directory in your system Folder.
In the second example, you are saving it, and then telling your variable to look in a completely different location for the file (TemporaryPath), so that's not going to work.
If you have FileMaker Pro Advanced, use the Script Debugger and Data Viewer to make sure that your $Output has the correct format that will work with your OS for Send Mail. To see the correct formats, when you are in the Send Mail Specify box in the script, hit the Specify button next to the Attach file checkbox, at the bottom, you will see path examples. My guess is that your path would have to be similar to those examples.
If you don't have Advanced, you can add a show custom dialogue command and put your variable into it and run the script.
Good luck, hope this helps.
… and with Mac, the Attachment maybe won't be included properly if Script is set to
Send Mail [ Send via Email Client ; With Dialog: Off ]
path is wrong..
"file:" & Get ( TemporaryPath ) etc
if you want to check if the file is created change to Get ( DocumentsPath ) while you are testing , then you can see the file
just because you are using a variable in the file path, it still needs to be like the examples that are in the actual dialog box