You need to include the script tags with the source attribute. I believe you should be able to keep the external JS file anywhere as long as it is on the same server for security reasons.
The attached example shows that you can replace a lectora variable with a variable from external JS. This is good because you do not have to re-publish to change the variable.
I’ve asked this before. If a Trivantis application developer see this I would like to know what the thought process is behind the “bottom of file scripting” HTML Extension. Why does it work the way it does? JS script tags belong just above the closing body tag, not after the HTML closing tag as it currently works. Please fix it to follow proper web standards. If there is some other reason for having bottom of file scripting that I am unaware of then please add another option to add links to JS just above the closing body tag – call it “add external JS scripting”.