10. (20 points) Given the sequence $\left\{a_{n}\right\}$ satisfies $a_{1}=1$, $a_{2}=9$, and for any positive integer $n$,
$$
n a_{n+2}-6(n+1) a_{n+1}+9(n+2) a_{n}=0 \text {. }
$$

Find the general term formula of the sequence $\left\{a_{n}\right\}$.
10. From the given, we have
$$
\begin{array}{l}
n\left(a_{n+2}-3 a_{n+1}\right)=3(n+2)\left(a_{n+1}-3 a_{n}\right) \\
\Rightarrow \frac{a_{n+2}-3 a_{n+1}}{3(n+2)}=\frac{a_{n+1}-3 a_{n}}{n} \\
\Rightarrow \frac{a_{n+2}-3 a_{n+1}}{3^{n+1}(n+2)(n+1)}=\frac{a_{n+1}-3 a_{n}}{3^{n}(n+1) n} \\
\Rightarrow \frac{a_{n+1}-3 a_{n}}{3^{n}(n+1) n}=\frac{a_{n}-3 a_{n-1}}{3^{n-1} n(n-1)}=\cdots \\
=\frac{a_{2}-3 a_{1}}{3 \times 2 \times 1}=1 \\
\Rightarrow a_{n+1}-3 a_{n}=3^{n} n(n+1)\left(n \in \mathbf{N}_{+}\right) \\
\Rightarrow \frac{a_{n+1}}{3^{n+1}}-\frac{a_{n}}{3^{n}}=\frac{1}{3} n(n+1) \text {. } \\
\end{array}
$$

Let $b_{n}=\frac{a_{n}}{3^{n}}\left(n \in \mathbf{N}_{*}\right)$. Then
$$
\begin{array}{l}
b_{1}=\frac{1}{3}, b_{n+1}-b_{n}=\frac{1}{3} n(n+1) \\
\Rightarrow b_{n}=b_{1}+\sum_{i=1}^{n-1}\left(b_{i+1}-b_{i}\right) \\
=\frac{1}{3}+\frac{1}{3} \sum_{i=1}^{n-1} i(i+1)=\frac{n^{3}-n+3}{9}(n \geqslant 2) \\
\Rightarrow a_{n}=3^{n} b_{n}=3^{n-2}\left(n^{3}-n+3\right)(n \geqslant 2) .
\end{array}
$$

Upon verification, $a_{1}=1$ also satisfies the above formula.
Therefore, the general term formula for the sequence $\left\{a_{n}\right\}$ is
$$
a_{n}=3^{n-2}\left(n^{3}-n+3\right) \text {. }
$$