I have a map $f \;A \to B$ and a map $r \;B \to A$ such that $r \circ f = I_{A}$ but $r$ is not inverse of $f$ ie $f \circ r \neq I_{B}$. Now I have to find a map $g$ $C \to A$ such that $f\circ g =h$ where $h$ is a map $C \to B$. So basically I have to find the unknown in the equation
$$f \circ g = h\;\; ...(1)$$
So I apply map $r$ on both sides
$$ r\circ f \circ g = r\circ h$$ $$I_A \circ g = g = r \circ h$$
But know if I keep $g = r\circ h$ in equation $(1)$ LHS , it is not equal to the RHS. What blunder am I doing ?
Your reasoning shows that if there is a map $g$ such that $f\circ g=h$, then $g=r\circ h$. But there is no guarantee that such a $g$ exists, which is why you can't prove that $r\circ h$ is a solution to your problem. So your reasoning shows that if $f\circ r\circ h\neq h$, then there is no $g$ such that $f\circ g=h$.