I have the following text in a page. As you can see my shortcode is right at the bottom but somehow when the code runs, the output of my shortcode is inserted at the top of
Your shortcode handler is supposed to return the output to display in place of the shortcode, not output anything itself.
http://codex.wordpress.org/Shortcode_API