What script step are you using? Export Records, Export Field Contents or ...?
In each case, you would enter the name of the variable where you stored not just the filename but also the file path in the Specify Output File dialog.
I am trying to generate a PDF file from a found set of records that automatically generates the file name. I was trying to do it by creating a script and attaching it to a button. I tried using the Get (CurrentDate) function and the Substitute function to change the "/" to an "-" but it does not appear that the Specify Output File accepts those commands.
You can't put calculations into the the Specify Output File dialog, but you can use a calculation to put the results of that calculation into a variable and then you can put the variable into Specify Output File.
Here's a thread that describes this process for Save as PDF: Found Sets to PDF with unique file names