There are a number of issues with this approach:
1. You would need to include a session identifier in the .js file name to ensure you send the correct file to the correct browser.
2. You would need a way to do cleanup on the .js files periodically
3. Performance may suffer because you are generating a text file every time the script is run.