You are using country names as part of the new variable name that predict
is creating. However, when you get to "United Kingdom" your line
predict temp_`c'`y'
implies something like
predict temp_United Kingdom1812
But Stata sees that as two variable names where only one is allowed.
Otherwise put, you are being bitten by a simple rule: Stata does not allow spaces within variable names.
Clearly the same problem would bite with "United States".
The simplest fudge is to change the values so that spaces become underscores "_". Stata's OK with variable names including underscores. That could be
gen country2 = subinstr(country, " ", "_", .)
followed by a loop over country2
.
Note for everyone not up in historical details. 1812 is the year that British troops burnt down the White House. Feel free to substitute "1776" or some other date of choice.
(By the way, credit for a crystal-clear question!)