If I write the sentence "The table police the dog, while drinking", can I write it? Does it have any meaning?
Not everything that we can write, syntactically, must have meaning mathematically. Just like we can write utter nonsense (just look at the career Monty Python got out of it!), we can also write mathematical nonsense.
You can write $f=\{(0,f)\}$. Sure. But does it have any meaning?
Assuming $\sf ZF$, the answer is no. You can prove that such $f$ does not exist. Namely, there does not exist a set $f$ such that the unique element of $f$ is an ordered pair $(x,y)$ such that $x=0$ and $y=f$ itself. The reason is that any reasonable method for encoding ordered pairs will eventually create a cycle in the $\in$ relation.
Specifically, in the Kuratowski definition, $(0,f)=\{\{0\},\{0,f\}\}$, and then $f\in\{0,f\}\in(0,f)\in f$.
On the other hand, if you reject the axiom of regularity (also known as Foundation axiom), then it is a possibility for $x$ to be an element of an element of an element of $x$ itself. So it is possible to obtain such $f$. In that case, $f$ is indeed a function, and its range is $\{f\}$, of course. What else would it be?