For $a/q\in\mathbb{Q}$ the Estermann function is defined as $D(s,a/q):=\sum_{n\geq1}d(n)n^{-s}\operatorname{e}(n\frac aq)$ if $\Re(s)>1$ and by meromorphic continuation otherwise. For $q$ prime, we compute the moments of $D(s,a/q)$ at the central point $s=1/2$, when averaging over $1\leq a<q$. As a consequence we deduce the asymptotic for the iterated moment of Dirichlet $L$-functions $\sum_{\chi_1,\dots,\chi_k\mod q}|L(\frac12,\chi_1)|^2\cdots |L(\frac12,\chi_k)|^2|L(\frac12,\chi_1\cdots \chi_k)|^2$, obtaining a power saving error term. Also, we compute the moments of certain functions defined in terms of continued fractions. For example, writing $f_{\pm}(a/q):=\sum_{j=0}^r (\pm1)^jb_j$ where $[0;b_0,\dots,b_r]$ is the continued fraction expansion of $a/q$ we prove that for $k\geq2$ and $q$ primes one has $\sum_{a=1}^{q-1}f_{\pm}(a/q)^k\sim2 \frac{\zeta(k)^2}{\zeta(2k)} q^k$ as $q\to\infty$.