Write a function as $\sum _{n=0} ^{\infty} a_n x^n$ We have $f(x) = (x+ x^2 + x^3 + x^4 + x^5 + x^6)^4$.

Now I want to write this as $\sum _{n=0} ^{\infty} a_n x^n$.

What I got:

$f(x) = (x+ x^2 + x^3 + x^4 + x^5 + x^6)^4 = x^4 (1+ x + x^2 + x^3 + x^4 + x^5)^4$

We know: $\frac{1}{1-x} = \sum _{n=0} ^{\infty} x^n$.

Note that $\displaystyle \frac{d^3}{dx^3} (\frac{1}{1-x})= \frac{6}{(1-x)^4}$.

Then $\frac{1}{(1-x)^4} = \frac{1}{6} \sum n (n-1) (n-2) x^{n-3}$, what gives

$x^4 \frac{1}{(1-x)^4} = \frac{1}{6} \sum n (n-1) (n-2) x^{n+1} = \frac{1}{6} \sum  (n-1) (n-2) (n-3) x^{n}$

If I look now on Wolfram Alpha at the expanded form, this expression is only correct for $4 \leq n \leq 9$. For $n \geq 10$ it gives other values of the coefficients. What goes wrong?
We can write $$x+x^2+\cdots+x^6=\frac{x-x^7}{1-x}$$ and then we can expand the numerator with a binomial expansion:

$$(x+x^2+\cdots+x^6)^4 = \frac{(x-x^7)^4}{(1-x)^4} = (1-x)^{-4} \sum_{k=0}^4 {4 \choose k} (-1)^k x^{6k+4}$$

$$=\left( \frac16 \sum_{n=0}^\infty (n+3)(n+2)(n+1) x^{n} \right) \left( \sum_{n=0}^4 {4 \choose n} (-1)^n x^{6n+4} \right)$$

$$=\left( \frac16 \sum_{n=0}^\infty (n+3)(n+2)(n+1) x^{n} \right) \left( x^{4} - 4 x^{10} + 24 x^{16} - 4 x^{22} + x^{28}\right).$$

We can call $(n+3)(n+2)(n+1)=b_n$, for the sake of brevity.

$$=\frac16 \left( \sum_{n=0}^\infty b_n x^{n+4} - \sum_{n=0}^\infty 4b_n x^{n+10} + \sum_{n=0}^\infty 24 b_nx^{n+16} - \sum_{n=0}^\infty 4b_n x^{n+22} + \sum_{n=0}^\infty b_n x^{n+28}\right)$$

$$= \frac16 \left( \sum_{n=4}^\infty b_{n-4} x^{n} - \sum_{n=10}^\infty 4b_{n-10} x^{n} + \sum_{n=16}^\infty 24 b_{n-16}x^{n} - \sum_{n=22}^\infty 4b_{n-22} x^{n} + \sum_{n=28}^\infty b_{n-28} x^{n}\right)$$

Finally we have $$\frac16
\left(\sum_{n=4}^{9} (n-1)(n-2)(n-3) x^n +\sum_{n=10}^{15} \left[(n-1)(n-2)(n-3) - 4 (n-7)(n-8)(n-9)\right] x^n + \sum_{n=16}^{21} \left[(n-1)(n-2)(n-3) - 4 (n-7)(n-8)(n-9) + 24(n-13)(n-14)(n-15)\right]x^n +
\sum_{n=22}^{27} \left[(n-1)(n-2)(n-3) -  4 (n-7)(n-8)(n-9) + 24(n-13)(n-14)(n-15)-4(n-19)(n-20)(n-21)\right]x^n
+\sum_{n=28}^{\infty} \left[(n-1)(n-2)(n-3) - 4 (n-7)(n-8)(n-9) + 24(n-13)(n-14)(n-15)-4(n-19)(n-20)(n-21) + (n-25)(n-26)(n-27)\right]x^n\right).$$

However, we know that the resulting polynomial has a degree of $24$, thus all of the coefficients for the last series must be zero, and the coefficients of $x^{25}$, $x^{26}$ and $x^{27}$ are zero. This can be verified by expanding the polynomials in $n$. Thus:

$$
\sum_{n=4}^{9} \frac{(n-1)(n-2)(n-3)}{6} x^n + \sum_{n=10}^{15} \frac{\left[(n-1)(n-2)(n-3) - 4 (n-7)(n-8)(n-9)\right]}{6} x^n + \sum_{n=16}^{21} \frac{\left[(n-1)(n-2)(n-3) - 4 (n-7)(n-8)(n-9) + 24(n-13)(n-14)(n-15)\right]}{6}x^n + \sum_{n=22}^{24} \frac{\left[(n-1)(n-2)(n-3) - 4 (n-7)(n-8)(n-9) + 24(n-13)(n-14)(n-15)-4(n-19)(n-20)(n-21)\right]}{6} x^n$$
You're mixing up finite sums with infinite sums.

Another problem is that anything calcualted using an infinite sum is likely to have limited validity. Why add that constraint to your solution?

You have that $f(x) = x^4 (1+ x + x^2 + x^3 + x^4 + x^5)^4$

Why not just expand that bracket?

$(1+ x + x^2 + x^3 + x^4 + x^5)^2$

$=1+ x + x^2 + x^3 + x^4 + x^5$

$..... + x + x^2 + x^3 + x^4 + x^5 +x^6$

$.........+x^2 + x^3 + x^4 + x^5 +x^6+x^7$

$..............+x^3 + x^4 + x^5 +x^6+x^7+x^8$

$...................+x^4 + x^5 +x^6+x^7+x^8+x^9$

$........................+x^5 +x^6+x^7+x^8+x^9+x^{10}$

$=1+ 2x + 3x^2 + 4x^3 + 5x^4 + 6x^5 +5x^6+4x^7+3x^8+2x^9+x^{10}$

Then find $\left( 1+ 2x + 3x^2 + 4x^3 + 5x^4 + 6x^5 +5x^6+4x^7+3x^8+2x^9+x^{10}\right)^2$

$= 1+ 2x + 3x^2 + 4x^3 + 5x^4 + 6x^5 +5x^6+4x^7+3x^8+2x^9+x^{10}$

$..... + 2x + 4x^2 + 6x^3 + 8x^4 + 10x^5 +12x^6+10x^7+8x^8+6x^9+4x^{10}+2x^{12}$

Coefficients are:

 1                                    =  1
 2+  2                                =  4
 3+  4+  3                            = 10
 4+  6+  6+  4                        = 20
 5+  8+  9+  8+ 5                     = 35
 6+ 10+ 12+ 12+ 10+  6                = 56
 5+ 12+ 15+ 16+ 15+ 12+  7            = 82
 4+ 10+ 18+ 20+ 20+ 18+ 14+  8        =112
 3+  8+ 15+ 24+ 25+ 24+ 21+ 16+  9    =145
 2+  6+ 12+ 20+ 30+ 30+ 28+ 24+ 18+ 10=180
 1+  4+  9+ 16+ 25+ 36+ 35+ 32+ 27+ 20=205
     2+  6+ 12+ 20+ 30+ 42+ 40+ 26+ 30=218
                                      =218
                                      =204
                                      =175
                                      =130
                                      = 90
                                      = 56
                                      = 29
                                      = 10