9. (16 points) Given the sequence $\left\{a_{n}\right\}$, where $a_{1}=1, a_{2}=\frac{1}{4}$,
and $a_{n+1}=\frac{(n-1) a_{n}}{n-a_{n}}(n=2,3, \cdots)$.
(1) Find the general term formula for the sequence $\left\{a_{n}\right\}$;
(2) Prove that for all $n \in \mathbf{N}_{+}$, $\sum_{k=1}^{n} a_{k}^{2}<\frac{7}{6}$.
(1) From the given, for $n \geqslant 2$ we have
$$
\frac{1}{a_{n+1}}=\frac{n-a_{n}}{(n-1) a_{n}}=\frac{n}{(n-1) a_{n}}-\frac{1}{n-1} \text {. }
$$

Dividing both sides by $n$ and rearranging, we get
$$
\frac{1}{n a_{n+1}}-\frac{1}{(n-1) a_{n}}=-\left(\frac{1}{n-1}-\frac{1}{n}\right) \text {. }
$$

Then, $\sum_{k=2}^{n-1}\left[\frac{1}{k a_{k+1}}-\frac{1}{(k-1) a_{k}}\right]$
$$
=-\sum_{k=2}^{n-1}\left(\frac{1}{k-1}-\frac{1}{k}\right)=-\left(1-\frac{1}{n-1}\right),
$$

which implies $\frac{1}{(n-1) a_{n}}-\frac{1}{a_{2}}=-\left(1-\frac{1}{n-1}\right)(n \geqslant 2)$.
Thus, $\frac{1}{(n-1) a_{n}}=\frac{1}{a_{2}}-\left(1-\frac{1}{n-1}\right)=\frac{3 n-2}{n-1}$.
Therefore, $a_{n}=\frac{1}{3 n-2}(n \geqslant 2)$.
And when $n=1$, it also holds, hence
$$
a_{n}=\frac{1}{3 n-2}\left(n \in \mathbf{N}_{+}\right) \text {. }
$$
(2) For $k \geqslant 2$, we have
$$
\begin{array}{l}
a_{k}^{2}=\frac{1}{(3 k-2)^{2}}<\frac{1}{(3 k-4)(3 k-1)} \\
=\frac{1}{3}\left(\frac{1}{3 k-4}-\frac{1}{3 k-1}\right) .
\end{array}
$$

Therefore, for $n \geqslant 2$, we have
$$
\begin{aligned}
& \sum_{k=1}^{n} a_{k}^{2}=1+\sum_{k=2}^{n} a_{k}^{2} \\
< & 1+\frac{1}{3} \sum_{k=2}^{n}\left(\frac{1}{3 k-4}-\frac{1}{3 k-1}\right) \\
= & 1+\frac{1}{3}\left(\frac{1}{2}-\frac{1}{3 n-1}\right)<1+\frac{1}{6}=\frac{7}{6} .
\end{aligned}
$$

And when $n=1$, $a_{1}^{2}=1<\frac{7}{6}$.
Thus, for all $n \in \mathbf{N}_{+}$, we have $\sum_{k=1}^{n} a_{k}^{2}<\frac{7}{6}$.