How can I pass a shortcode value to the head in wordpress functions.php

Shortcodes, as I understand them, are to be used inside content of pages/posts, and (with 4.9) widgets. They aren’t supported inside other spots on the page, only in the page/post/widget content.

From the Codex: https://codex.wordpress.org/Shortcode

[WP] only expands the shortcodes within the content of a Post, Page,
or custom post type.

But I don’t think your code should be setting a shortcode. Perhaps it should be setting a global variable that will be used elsewhere. (But it is late, and I am under the influence of excessive turkey…)