I am trying to do the exercise that reads as follows,
Suppose you have two objects $A$ and $A'$ in a Category $D$, and morphisms $i_C:Mor(C, A) → Mor(C,A′)$ that commute with the maps $Mor(C,A) → Mor(B,A)$ (which are induced by some morphism $f:B→C$). Show that the $i_C$ (as $C$ ranges over the objects of $D$) are induced from a unique morphism $g: A → A′$ . More precisely, show that there is a unique morphism $g: A → A′$ such that for all $C \in D$ , $i_C$ is $u\mapsto g\circ u$.
What I have done so far, is using the Hint below the problem, I set $Mor(A,A)\rightarrow Mor(A,A')$, so we have $Mor(A,A)$ is non-empty since it contains the identity. If I call the identity morphism of $A$, $I_A$, my guess is that $g=i_A(I_A)$. Now, here's where I don't know think I am following correctly: I assume $Mor(C,A)$ is non-empty, so that I can use the hypothesis of the commutative diagram: $$\require{AMScd} \begin{CD} \operatorname{Mor}(A,A) @>{i_A}>> \operatorname{Mor}(A,A')\\ @V{}VV @V{}VV \\ \operatorname{Mor}(C,A) @>{i_C}>> \operatorname{Mor}(C,A') \end{CD}$$ Composing morphisms I get $i_C(u\circ I_A)=u\circ i_A(I_A)$, which in notation of the problem, is $u\mapsto u\circ g$, which is the reverse of what I should be getting. (The right hand side of my computation was obtained through the upper part of the diagram, while the left side was obtained from the lower side of the diagram).
So my questions are, should I have not assumed that $Mor(C,A)$ was non-empty? Am I in the correct direction with the diagram?
Yes, your reasoning is correct. There is no need to assume $\hom$-sets to be nonempty. In order to prove this version (which is actually a part) of the Yoneda Lemma, it is sufficient to show that for every object $C\in Obj(\mathcal{D})$ and every morphism $u\colon C\to A$ the equality $i_C(u)=g\circ u$ holds. So, if there is no morphisms $C\to A$, then "any equality holds for any morphism $C\to A$", as we are taught by mathematical logic.
Your mistake in the end is related to the action of the right arrow in the diagram. It is $\text{Mor}(u,A')\colon \text{Mor}(A,A')\to \text{Mor}(C,A')$, which acts in the following way: $\text{Mor}(u,A')(f)=f\circ u$, not $u\circ f$.