OK, so the code is wrong, because there are a lot of errors in it:
- Shortcodes should return its results and they shouldn’t print anything.
- Shortcode callback takes an array of attributes as first param and not an ID.
- You don’t do anything with the parameter of your shortcode callback.
- You don’t pass any ID to get_the_category, so it will return array of categories for current post.
- You don’t check if there is any category assigned (get_the_category can return empty array).