I am studying A course in theory of groups by Robinson. When defining the central extension of groups, the author says that
Every nilpotent group can be constructed from abelian groups by means of a sequence of central extensions.
What do I understand by this line is that for every nilpotent group $G$ there exists groups $H$ and $K$ such that $H\subseteq Z(K)$ and the exact sequence. $$\{1\}\to H \to K\to G\to \{1\}.$$ But I can not prove this, please help me to do this.
A nilpotent group of class $0$ is the trivial group.
A nilpotent group of class $1$ is a nontrivial abelian group. In particular, $G/Z(G)$ is nilpotent of class $0$ (trivial).
A nilpotent group of class $2$ is a group $G$ such that $G/Z(G)$ is nilpotent of class $1$ (that is, nontrivial and abelian). In particular, you have an exact sequence $$ 1 \to Z(G)\to G\to G/Z(G)\to 1$$ with $G/Z(G)$ nontrivial abelian; or, in your notation, nontrivial abelian groups $H$ and $K$ such that $$1 \to H\to G\to K\to 1$$ where $H\to G$ sends $H$ into $Z(G)$.
A nilpotent group of class $3$ is a group $G$ such that $G/Z(G)$ is nilpotent of class $2$. Thus, there exists an exact sequence $$1 \to H \to G \to K\to 1$$ with $H$ nontrivial abelian, where $H\to G$ sends $H$ into $Z(G)$, and $K$ is nilpotent of class $2$.
In general, $G$ is nilpotent of class $n+1$ if and only if $G/Z(G)$ is nilpotent of class $n$; so there is an exact sequence $$1 \to H \to G \to K\to 1$$ with $H$ nontrivial abelian, the map $H\to G$ sends $H$ into $Z(G)$, and $K$ is nilpotent of class $n$.
In general, if $G$ is a group and we have an exact sequence $$1 \to H \stackrel{f}{\to} G\to K\to 1$$ where $H$ is abelian, $f(H)\subseteq Z(G)$, and $K$ is nilpotent of class at most $n$, then $G$ is nilpotent of class at most $n+1$.