Let WordPress to go opening an external URL

You forgot to add the “http” to the url

Try please this:

$link = "<a href="http://"https://wordpress.stackexchange.com/questions/254153/. $_COOKIE["link'] ."'>TEXT SHOWN</a>";

You also can adjust and add the http:// to the $_COOKIE itself.

If you want that the new link will open in a new tab, add target="_blank" like so:

$link = "<a href="http://"https://wordpress.stackexchange.com/questions/254153/. $_COOKIE["link'] ."' target="_blank">TEXT SHOWN</a>";