Need to put a script above tag in header.php – WP 5.7.1

As @Buttered_Toest mentioned, this snippet works well.
(This code goes to functions.php)

function futy_widget_footer(){ ?>
    <script>
        window.Futy = { key: '0000000000' }; (function (e, t) { var n = e.createElement(t); n.async = true; n.src="https://v1.widget.futy.io/js/futy-widget.js"; var r = e.getElementsByTagName(t)[0]; r.parentNode.insertBefore(n, r); })(document, 'script'); 
    </script>
<?php } 

add_action('wp_footer','futy_widget_footer');