Operation in homotopy group agrees with $H$ space multiplication. Let $X$ be an $H$-space, i.e. there is a multiplication $\mu\colon X\times X\to X$ continuous with an identity $e$ such that $(x\mapsto \mu(e,x))\simeq (x\mapsto\mu(x,e))\simeq \text{id}_X$.
I want to show that the addition of two maps $f,g\in\pi_n(X,x_0)$ may be given by $(f+g)(x)=\mu(f(x),g(x))$, but I am unsure of what to do exactly. 
This is problem 4.1.3 in Hatcher's Algebraic Topology book.
 A: This depends on a results called the "interchange law" or the "Eckman-Hilton argument".
Let $S $ be a set with two monoid structures $\circ_1, ~ \circ_2 $
each of which is a morphism for the other. Then the two monoid
structures coincide and are abelian. 
It is crucial for this that a morphism of monoids preserves the identities. 
Here is a sketch of the argument.
The compatibility of the two structures is expressed by saying that the matrix composition 
$$\begin{bmatrix}x&y \\ z&w
\end{bmatrix}$$
where vertically gives $\circ_1$ and horizontally gives $\circ_2$, has only one result, which linear notation  says 
$$(x \circ_1 z)\circ_2(y \circ_1 w)= (x \circ_2y)\circ_1 (z \circ_2 w).$$
Now you make substitutions to obtain $e_1=e_2$, i.e. equality of the identities, 
which you now write as $e$, and further substitutions to obtain $x \circ_1 y= x\circ_2y$, which we now write as $x \circ y$,  and finally, with another sustitution, obtain  $x\circ y= y \circ x$. 
Note that this argument does not work if one composition is a a monoid and the other is a semigroup, or if one is a category, so with many identities. So "higher dimensional groups" are abelian groups, but higher dimensional groupoids can be  much more complicated than  groupoids, and so model more geometry. 
