The axiom schema of replacement needs a function, defined by ${\forall}y({\exists}x:({\forall}z(P(y,z){\iff}(x=z))))$, where $f(y)=x$.
My question is: why isn't ${\exists}$ replaced by ${\exists}!$?
Shouldn't it be specifically stated that there needs to be only a single $x$, since it's a function.
No. The axiom already implies that there's only one such $x$.
Given $y$, let $x$ and $x'$ be elements with ${\forall}z(P(y,z){\iff}(x=z))$ and ${\forall}z(P(y,z){\iff}(x'=z))$. Using $z=x$ in the first statement yields $P(y,x)\iff(x=x)$, and thus $P(y,x)$; then using $z=x$ in the second statement yields $P(y,x)\iff(x'=x)$, and thus $x'=x$.