There is nothing wrong with the way you did it. The ansatz made by whoever wrote the solution is an application of separation of variables, very similar to your approach. First, though, there is an issue with your solution, which I'll address below.
To start, your eigenfunction for $T(t)$ is wrong, and certainly should not contain any terms in $x$. When solving the ODEs in $X$ and $T$, you only the apply homogeneous conditions. Once you have done that, construct your solution as a Fourier series, then apply the inhomogeneous condition.
Following above, the solution to $T'' = - c^{2} \omega^{2} T$ (where $\omega$ is the eigenvalue you found) with the homogeneous boundary condition
$$v_{t}(x,0) = 0 \implies T'(0) = 0 \tag 1$$ is given by
$$T_{n}(t) = B_{n} \cos \left( \frac{(2n+1)\pi c t}{2L} \right)$$
This yields the solution for $v$ as a Fourier series
\begin{align}
v(x,t) &= \sum_{n \ge 0} X_{n}(x) T_{n}(t) \\
&\sum_{n \ge 0} A_{n} \cos \left( \frac{(2n+1)\pi x}{2L} \right) \cos \left( \frac{(2n+1)\pi c t}{2L} \right) \tag 2
\end{align}
Substituting in the inhomogeneous boundary condition, we find
\begin{align}
v(x,0) &= \sum_{n \ge 0} A_{n} \cos \left( \frac{(2n+1)\pi x}{2L} \right) \\
&= -u_{\text{stat}}(x) \tag 3
\end{align}
and multiplying both sides by $\cos \left( \frac{(2m+1)\pi x}{2L} \right)$ and integrating over the domain $x \in [0,L]$ gives
\begin{align}
\sum_{n \ge 0} A_{n} \int_{0}^{L} \cos \left( \frac{(2n+1)\pi x}{2L} \right) \cos \left( \frac{(2m+1)\pi x}{2L} \right) dx &= - \int_{0}^{L} u_{\text{stat}}(x) \cos \left( \frac{(2m+1)\pi x}{2L} \right) dx
\end{align}
which yields the coefficients (for $n = m$)
\begin{align}
A_{n} = - \frac{2}{L} \int_{0}^{L} u_{\text{stat}}(x) \cos \left( \frac{(2n+1)\pi x}{2L} \right) dx \tag 4
\end{align}
and hence after solving the above integrals, you have the solution to your PDE as a Fourier series.
Now, imagine after doing separation of variables that you hadn't yet solved the ODE in $T$ but had only solved the ODE in $X$, given by $X'' = - \omega^{2} X$. Then, as we know the solution will be a Fourier series, we can assume the solution $v(x,t)$ takes the general form
$$v(x,t) = \sum_{n \ge 0} X_{n}(x) T_{n}(t)$$
which is essentially what we have written at $(2)$ (note that our $X_{n}(x) = \cos \left( \frac{(2n+1)\pi x}{2L} \right)$ is the solutions $f_{n}(x)$. Similarly, $T_{n}(t) = a_{n}(t)$). Substituting into the PDE yields
\begin{align}
v_{tt} - c^{2} v_{xx} &= \sum_{n \ge 0} X_{n}(x) T''_{n}(t) - c^{2} \sum_{n \ge 0} X''_{n}(x) T_{n}(t) \\
&= \sum_{n \ge 0} X_{n}(x) T''_{n}(t) - c^{2} X''_{n}(x) T_{n}(t) \\
&= \sum_{n \ge 0} X_{n}(x) T''_{n}(t) + c^{2} \omega^{2} X_{n}(x) T_{n}(t) \qquad \text{(as $X'' = - \omega^{2} X$)} \\
&= \sum_{n \ge 0} [T''_{n}(t) + c^{2} \omega^{2} T_{n}(t)]X_{n}(x) \\
&= 0 \qquad \text{(from the PDE)}
\end{align}
We know that $X_{n}(x) \ne 0$, hence we must have
$$T''_{n}(t) + c^{2} \omega^{2} T_{n}(t) = 0$$
We also need to use our initial conditions. Again, as $X_{n}(x) \ne 0$
\begin{align}
v_{t}(x,0) &= \sum_{n \ge 0} X_{n}(x) T'_{n}(0) \\
&= 0 \\
\implies T'_{n}(0) &= 0 \qquad \forall n
\end{align}
Notice that this is essentially the same condition we have at $(1)$. Applying the last condition
\begin{align}
v(x,0) &= \sum_{n \ge 0} X_{n}(x) T_{n}(0) \\
&= -u_{\text{stat}}(x)
\end{align}
which is essentially what we have written at $(3)$. So, just like we did after $(3)$, we multiply both sides by $X_{m}(x)$ and integrate over the domain, which gives
\begin{align}
\sum_{n \ge 0} T_{n}(0) \int_{0}^{L} X_{n}(x) X_{m}(x) dx &= -\int_{0}^{L} X_{m}(x) u_{\text{stat}}(x) dx
\end{align}
and using the result at $(4)$, we get that
$$T_{n}(0) = - \frac{2}{L} \int_{0}^{L} X_{n}(x) u_{\text{stat}}(x) dx$$
which is the other condition.
Best Answer
It's saddening to read such a question from an "aspiring $\ldots$ scientist" (according to his profile).
Why should we do trigonometry, or some other kind of geometry, if we can measure lengths or angles with any desired precision using a yardstick or a protractor?
Aren't you aware that the "praised PDE researchers" dig up universal truths, valid for all PDEs of this or that kind, whereas numerical solutions in most cases are about a single problem instance. E.g., how could you find out (let alone prove) by numerically solving millions of ODE's to the highest precision that under certain geometric circumstances there has to be a periodic solution?