Dan,
Select the text you want to save by holding down the left arrow and highlighting the text in the script.
Then right-click and select ‘copy’
Open notepad (or any other text editor), paste the text into it and save the file with the name suggested by Mike above.
That then gives you a new file containing just the script. Reference that file as suggested by mike.
To the best of my knowledge the ‘save as’ does not work for selected text in browsers – only images or referenced links.
Hope this helps