You need to overwrite the file app/code/Magento/Theme/view/base/templates/root.phtml
When you open this file you will see something look like:
<!doctype html>
<html <?php echo $htmlAttributes ?>>
<head <?php echo $headAttributes ?>>
<?php echo $requireJs ?>
<?php echo $headContent ?>
<?php echo $headAdditional ?>
</head>
<body data-container="body" data-mage-init='{"loaderAjax": {}, "loader": { "icon": "<?php echo $loaderIcon; ?>"}}' <?php echo $bodyAttributes ?>>
<?php echo $layoutContent ?>
</body>
<!-- BUT YOUR'S SCRIPTS HERE-->
</html>
You can overwrite this file by create new theme, and put this file in app/design/frontend/Vendor/ThemeName/Magento_Theme/templates/root.phtml