# $\langle X, K(G, 1)\rangle \to H^1(X; G)$ sending $f: X \to K(G, 1)$ to induced homomorphism $f_*: H_1(X) \to H_1(K(G, 1)) \approx G$ is a bijection?

Let $\langle X, Y\rangle$ be the set of basepoint-preserving homotopy classes of basepoint-preserving maps $X \to Y$.

I can show the following result.

Lemma. Let $X$ be a connected CW complex and let $Y$ be a $K(G, 1)$. Then every homomorphism $\pi_1(X, x_0) \to \pi_!(Y, y_0)$ is induced by a map $(X, x_0) \to (Y, y_0)$ that is unique up to homotopy fixing $x_0$.

Question. How do I see that if $X$ is a connected CW complex and $G$ is an abelian group, then the map $\langle X, K(G, 1)\rangle \to H^1(X; G)$ sending a map $f: X \to K(G, 1)$ to the induced homomorphism $f_*: H_1(X) \to H_1(K(G, 1)) \approx G$ is a bijection, where we identify $H^1(X; G)$ with $\text{Hom}(H_1(X), G)$ via the universal coefficient theorem?

The underlying structure is that, for $G$ an abelian group, any group homomorphism $G' \to G$ is uniquely determined by a homomorphism $\text{Ab}(G') \to G$, where $\text{Ab}$ is the abelianization functor. This can be seen through the following commutative diagram: $$\require{AMScd} \begin{CD} G' @>>> G\\ @V\text{Ab}VV @| \\ \text{Ab}(G') @>>> G \end{CD}$$
Let $\alpha \in H^1(X;G) \cong \text{Hom}(H_1(X),G)$. Let $Y$ be $K(G,1)$. We can define a map $\overline{\alpha} : \pi_1(X,x_0) \to \pi_1(Y,y_0) \cong G$ by the above correspondence. By your stated lemma, we see there is a map $g : (X,x_0) \to (Y,y_0)$, unique up to homotopy fixing $x_0$, such that $g_\ast = \overline{\alpha}$. The standard induced map ${g_\ast} : H_1(X) \to H_1(Y)$ is given by applying the abelianization functor to $g_\ast : \pi_1(X) \to \pi_1(Y)$. By the above diagram, abelianization of $\overline{\alpha}$ gives $\alpha$. Thus $$\text{Ab}(g_\ast) = \text{Ab}(\overline{\alpha}) = \alpha.$$ This gives surjectivity of the map we are interested in.
For injectivity, after fixing basepoints, let $\alpha$ be the image of some map $f : (X,x_0) \to (Y,y_0)$ under the map $\langle X,Y \rangle \to H^1(X;G)$, and apply the above argument to find $g$. Note that $g$ and $f$ induce the same map $\overline{\alpha}$ on fundamental groups through the above diagram. By uniqueness of $g$, we see that $g$ and $f$ are equal in $\langle X, Y \rangle$. This proves injectivity.