Perhaps it helps to first think about how you can construct a map $\alpha_k : \Sigma^k S(\pi_k M) \to M$ inducing an isomorphism on $\pi_k$. Choose a free resolution
$$
0 \to \bigoplus_{j \in J} \mathbb{Z} \to \bigoplus_{i \in I} \mathbb{Z} \to \pi_k(M) \to 0
$$
and realize it in $H_k$ by a homotopy cofiber sequence
$$
\bigvee_{j \in J} S^k \to \bigvee_{i \in I} S^k \to \Sigma^k S(\pi_k M) .
$$
Mapping to $M$ you obtain an exact sequence
$$
\dots \to [\Sigma^k S(\pi_k M), M] \to Hom(\bigoplus_{i \in I} \mathbb{Z}, \pi_k(M))
\to Hom(\bigoplus_{j \in J} \mathbb{Z}, \pi_k(M)) \to \dots
$$
In particular,
$$
[\Sigma^k S(\pi_k M), M] \to Hom(\pi_k(M), \pi_k(M))
$$
is surjective. Choose $\alpha_k$ so that it maps to the identity. Then $\pi_k(\alpha_k) : \pi_k(\Sigma^k S(\pi_k M)) \to \pi_k(M)$ is an isomorphism. (You should check this last claim.)

Using the $H\mathbb{Z}$-module structure on $M$, you can factor $\alpha_k$ as the Hurewicz map
$$
h : \Sigma^k S(\pi_k M) \to H\mathbb{Z} \wedge \Sigma^k S(\pi_k M) \simeq \Sigma^k H(\pi_k M)
$$
followed by
$$
\tilde \alpha_k : \Sigma^k H(\pi_k M) \to M .
$$
By the Hurewicz theorem, $\pi_k(h)$ is an isomorphism. (One way to see this is to show that $H\mathbb{Z}$ can be built as a CW spectrum from $S$ by only adding $n$-cells for $n\ge2$, which does not change $\pi_0$.) Thus $\pi_k(\tilde \alpha_k)$ is an isomorphism. Taking the wedge sum of the maps $\tilde \alpha_k$ for all integers $k$
gives the weak equivalence $\bigvee_k \Sigma^k H(\pi_k M) \to M$.