If $X$ is co-H, then $\pi_1(X)$ must be a free group. If $X$ is H, then $\pi_1(X)$ must be abelian. The only free group that is abelian is $\mathbb{Z}$. Argument for the first assertion: The co-H structure (and Van Kampen) gives a factorization $$ \pi_1(X)\xrightarrow{i_*} \pi_1(X)*\pi_1(X)\xrightarrow{j_*} \pi_1(X)\times\pi_1(X) $$ of the map $\Delta_*$ induced by the diagonal $\Delta:X\to X\times X$. This shows that $\pi_1(X)$ is isomorphic to a subgroup of $G = (j_*)^{-1}( \mathrm{im}(\Delta_{*}))$, which is free on the elements $\{ x \bar x\}$ ($x$ and $\bar x$ represent the same element $x\in\pi_1(X)$ in the two summands of $\pi_1(X)*\pi_1(X)$). Now we are done because a subgroup of a free group is free.