Let $G$ be an abelian group. Using the universal coefficient theorem and the Hurewicz theorem we can prove: $$ H^n(K(G,n),G) \cong Hom(H_n(K(G,n),G),G) \cong Hom(\pi_n(K(G,n)),G) \cong Hom(G,G)$$ Calling $u$ the element corresponding to the identity of $G$ we define: $$\psi: [X,K(G,n)] \rightarrow H^n(X,G) \quad \psi(f) = H^n(f)(u)$$ Where $[X,K(G,n)]$ is the set of continuous map from $X$ to $K(G,n)$ modulo homotopy equivalence. My professor said that this map is a bijection. I don't understand why. Recently I came across the Yoneda's Lemma and it seems to me it could be used here to prove the statement. Unfortunately I'm not able to understand which should be the functors/the spaces.
I would be grateful if someone can explain me how to use the Yoneda's Lemma or in case I'm wrong how to prove the statement. Thank you.