First of all, recall that it follows from Wald's identities that
$$\mathbb{P}(X_{T}=-b) = \frac{a}{a+b} \qquad \mathbb{P}(X_{T} = a) = \frac{b}{a+b} \qquad \mathbb{E}(T)=ab, \tag{1}$$
see e.g. this answer for a proof or Corollary 5.11 in Brownian Motion - An Introduction to Stochastic Processes (by René Schilling and Lothar Partzsch).
Part I: Calculate $\mathbb{E}(\int_0^T X_s \, ds)$:
It follows from Itô's formula that $$\int_0^t X_s \, ds = - \int_0^t X_s^2 \, dX_s + \frac{X_t^3}{3}.$$ Since the first term on the right-hand side is a martingale, the optional stopping theorem (applied to the bounded stopping time $T \wedge k$) yields
$$\mathbb{E} \left( \int_0^{T \wedge k} X_s \, ds \right) = \frac{1}{3} \mathbb{E}(X_{T \wedge k}^3).$$
As $|X_{s \wedge T}| \leq \max\{a,b\}$ for all $s \geq 0$, it now follows from the dominated convergence theorem that
$$\mathbb{E} \left( \int_0^T X_s \, ds \right) = \frac{1}{3} \mathbb{E}(X_T^3).$$
Finally, using $$X_T = a 1_{\{X_T=a\}} -b 1_{\{X_T=-b\}},$$ we obtain $$\mathbb{E} \left( \int_0^T X_s \, ds \right) = \frac{(-b)^3}{3} \mathbb{P}(X_T=-b) + \frac{a^3}{3} \mathbb{P}(X_T=a).$$
Plugging in the results from $(1)$, we are done.
Part II: Calculate $\mathbb{E}(T^2)$:
- Show that $M_t := X_t^3 -3 t X_t$ is a martingale and that (with a similar argumentation as in part I) $$\begin{align*} \mathbb{E}(X_T^3) &= 3a \mathbb{E}(T 1_{\{X_T} = a\}) -3b \mathbb{E}(T 1_{\{X_T}=-b\}) \\ &= 3a \mathbb{E}(T) - 3 (a+b) \mathbb{E}(T 1_{\{X_T = -b\}}). \tag{2} \end{align*}$$
- Use $(1)$ and Step 1 to calculate $\mathbb{E}(T 1_{\{X_T=-b\}})$.
- Show that $N_t := X_t^4-6t X_t^2 + 3t^2$ is a martingale. Using the optional stopping theorem show that $$\mathbb{E}(N_T)=0. \tag{3}$$
- Using the identity $$X_T = a 1_{\{X_T=a\}} -b 1_{\{X_T=-b\}},$$ step 2 and $(3)$ calculate $\mathbb{E}(T^2)$.