Scripts for logged-in users issue

Hello, I’m trying to make this script work by putting it into ‘Layout > Scripts for logged-in users’, but it doesn’t load the file scripts.js:

function loadScripts() {
var scripts = document.createElement('scripts');
script.type = 'text/javascript';
script.src = '';

window.onload = loadScripts;

What could be the reason why this doesn’t work? I’ve tried wrapping the script into , but that didn’t help and only added “unexpected <” error to the console.