Depending on the script, you may have options for ending it without logging out:
Many scripts that loop will either call themselves at the end of the script (i.e., you're running skillup.txt and the last line of the script is 'exec skillup.txt' - which is bad practice), or run an previously defined alias.
If the script you're stuck in is calling a script file at the end of it, just rename the .txt file; when the script gets to the point to execute the .txt file, it won't find it and end.
If the script is calling an alias to loop itself (i.e., at the beginning of the script it says 'alias startover' and the last line of the script is 'startover'), you can either enter 'alias startover /' into the console (or '//alias startover /' into the ffxi chat box) (no quotes on either), or you can do 'clearaliases'. clearaliases can be annoying if you have other aliases set up already, as you'd have to readd them (or re-run the script to add them).
If your script is just 800 lines of copy-pasted 'cast a spell' 'wait some time' 'repeat', then you'll have to close that windower instance as far as I know (I believe scripts will continue to run after you've logged out of a character).
Ideally,
the best option would be to use a script that you're able to break out of, but I wanted to mention a few options for people who may have gotten stuck. I preferred using Aikar's skillup scripts; they're simple, effective, and easy to customize without spellcast knowledge (see my post in the link Sekundes posted).