you were echoing things and in shortcode handling you have to return. i ran into some issues getting the script to work by returning the script, so i moved it to an external file which definitely works.