Finite or infinite dimensional is not a big deal (in finite dimensions all linear operators are compact, so that is for free).
We use the separability of the space to ensure that the orthonormal basis is countable. To get compactness, we define the following sequence of finite rank operators:
$$ T_n(x)=\sum_{j=1}^n \langle x, e_j\rangle T(e_j).$$
Can you show that $T_n\rightarrow T$? Cauchy-Schwarz inequality and Parseval's identity are quite useful :) also the fact that $B(H)$ is a Banach space with respect to the operator norm is pretty handy.
Define $T_k$ as you did above. Then we can pick $\Vert x \Vert \leq 1$ and use Cauchy-Schwarz to get for $\ell \geq k$
\begin{align} \Vert (T_\ell - T_k) (x) \Vert &\leq \sum_{n=k+1}^\ell \vert \langle x, e_n \rangle \vert \Vert T (e_n) \Vert \\ &\leq \left( \sum_{n=k+1}^\ell \vert \langle x, e_n \rangle \vert^2 \right)^\frac{1}{2} \left( \sum_{n=k+1}^\ell \Vert T (e_n) \Vert^2 \right)^\frac{1}{2}\\&\leq \Vert x \Vert \left( \sum_{n=k+1}^\ell \Vert T (e_n) \Vert^2 \right)^\frac{1}{2}\\&\leq \left( \sum_{n=k+1}^\ell \Vert T (e_n) \Vert^2 \right)^\frac{1}{2}.\end{align}
Where we used Parseval's identity$$ \Vert x \Vert^2 = \sum_{n\geq 1} \vert \langle x, e_n \rangle \vert^2.$$
Thus, we get that $(T_k)_{k\geq 1}$ is a Cauchy sequence in the operator norm. By completeness we get that there exists some bounded linear operator $S: H \rightarrow H $ such that $\lim_{k\rightarrow \infty} T_k=S$. We are left to show that $S=T$.
We note that $S(e_n) = \lim_{k\rightarrow \infty} T_k (e_n) = T(e_n)$. Furthermore, one can show that $X:=span{ e_n : n \geq 1 }$ is dense in $H$ (try to show this). Thus, $S=T$ on the dense subspace $X$ and by continuity of both $S$ and $T$ we get $S=T$.