I guess I'll give the context: I want to show that for an $n\geq 1$, given a CW-complex $X$ of dimension $n$, we have $H^n(X,\mathbb Z)\cong [X,S^n]$. I know the result which says that
$$H^n(X,\mathbb Z)\cong\langle X,K(\mathbb Z,n)\rangle,$$
where $K(\mathbb Z,n)$ is the Eilenberg-Maclane space with $n$-th homotopy group equal to $\mathbb Z$. I believe we can take $K(\mathbb Z,n)=P_n M(\mathbb Z,n)=P_nS^n$, where $P_n$ stands for the $n$-th degree space of the Postnikov tower (and $M(\mathbb Z,n)$ is the Moore space with $\mathbb Z$ for the $n$-th homotopy group). So I would like to show that