In Hatcher's Algebraic Topology, he proves Brouwer's fixed point theorem in dimension $2$.
He shows that if $f: D^2 \to D^2$ has no fixed points, then we can construct a retraction $r: D^2 \to S^1$. However, there cannot exist a retraction from $D^2 \to S^1$. So, $f$ must have a fixed point.
In the proof, the map looks like a perfectly fine map. But actually, it cannot be because there cannot exist such map.
However, I don't see what is wrong with this map. There cannot exist such a retraction, but in the proof, he constructs it. What is wrong with this $r$?

He can construct this $r$ precisely because we assume we never have $h(x)=x$.The construction is fine and continuous and well-defined under that assumption.
From this assumption comes a map we know cannot exist.
So the assumption was wrong.
It's a proof by contradiction. We don't construct a fixpoint, but derive a contradiction from the assumption we don't have any.