Finding a space with given homology groups and fundamental group
Solution 1:
This is a partial answer.
For any abelian group $G$ and integer $n \geq 1$, there is a CW complex $M(G, n)$ such that
$$\tilde{H}_i(M(G, n)) = \begin{cases} G & i = n\\ 0 & i \neq n \end{cases}$$
called a Moore space. Moreover, for $n > 1$, we can take these spaces to be simply connected. See Example $2.40$ of Hatcher's Algebraic Topology.
Using the fact that $H_n(\bigvee_{\alpha}X_{\alpha}) = \bigoplus_{\alpha}H_n(X_{\alpha})$, we see that for a given sequence of abelian groups $\{G_n\}_{n=1}^{\infty}$, the CW complex $X = \bigvee_{n=1}^{\infty}M(G_n, n)$ has the property that $H_i(X) = G_i$.
However, all that can be said of $\pi_1(X)$ is that its abelianisation is $G_1$. There are many different groups with the same abelianisation, so $\pi_1(X)$ may not be the group you wanted it to be.
If one could construct the Moore spaces $M(G, 1)$ with a given fundamental group (which must satisfy the necessary condition that its abelianisation is $G$), then the above space would have the desired properties. However, I don't know if this has been done.
Added Later: I asked a separate question about this final point (whether one could construct a Moore space $M(G, 1)$ with given fundamental group) here. It turns out it is not always possible.
Solution 2:
Dont, know if this answers your question, probably not, but if $\pi_n(x)=0$ for all $n>1$ then the homology groups $H_n(X)$ are determined by $\pi_1(X)$ in fact they are the group cohomology of the group $\pi_1(X)$. So you may want to have variable $\pi_n(X)$.
Solution 3:
Take the case where $H_1(X)=0$. It is not always possible since the first homology group is the abelianization of the fundamental group which is not always zero.