You should interpolate your PHP code into template strings. Double quotes " don’t do that: curly braces do.
So your ‘a’ tag in your template should look like this:
<a href="https://stackoverflow.com/questions/50408458/intrebare/lul.php?title={$hmm}">
(By the way I think you mistyped the variable reference with a & instead of $.)
solved Insert php variable in a href not working in second insert