I'm trying to apply the Euler–Maruyama discretization to a python code using this Wikipedia page Wikipedia page where it says that the SDE
$$dX_t = a(X_t, t) dt + b(X_t, t) dW_t, \quad X_0 = x_0 $$
can be approximated recursively by $$X_{t_{i+1}} = X_{t_i} + a(X_{t_i}, t_i) \Delta t + b(X_{t_i}, t_i) \Delta W_{t_i}, \quad X_{t_0} = x_0 \mbox{ for } 0 \leq i \leq N-1 \quad (1)$$
where $0 = t_0 <t_1< \cdots <t_N = T$, $\Delta t = T/N$ and $\Delta W_{t_i} = W_{t_{i+1}}- W_{t_i}$.
In my example, (thanks for Lutz Lehmann's remark), the SDE has the following form $$X_t = X_0 + \int_0^t \alpha(s) \bigg( \int_0^s \beta(u) X_u du\bigg)ds + \int_0^t b(X_s, s)dW_s$$
where $\alpha$ and $\beta$ are linear deterministic functions of $t$ that can be easily calculated.
I'm not sure how to calculate this inner integral and obtain recursively $X_u$ for each step $i$ as in $(1)$.
I start with writing
$$X_{t_{i+1}} = X_{t_i} + \int_{t_i}^{t_{i+1}} \alpha(s) \bigg( \int_{t_i}^s \beta(u) X_u du\bigg)ds + \int_{t_i}^{t_{i+1}} b(X_s, s)dW_s$$
However, applying Euler Forward scheme will result in
$$\int_{t_i}^{t_i} \beta(u) X_u du = 0$$
To overcome this I did the following, I assumed $$X_{t_{i+1}} = X_{t_i} + \int_{t_i}^{t_{i+1}} \alpha(s) \bigg( \int_{0}^s \beta(u) X_u du\bigg)ds + \int_{t_i}^{t_{i+1}} b(X_s, s)dW_s$$ and for each step $i$:
set $s_0 = 0$ and $s_M = t_i$ where $0 = s_0 <s_1 < \cdots <s_M=t_i$ and $\Delta s = t_i / M$
set $\beta_{s_0}X_{s_0} = \beta x_0$ and approximate using the simple Forward Euler method $$\begin{align} \beta_{s_1} X_{s_1} &\approx \beta_{s_0} X_{s_0} + \Delta s \beta_{s_0} X_{s_0} \\ \beta_{s_2} X_{s_2} &\approx \beta_{s_1} X_{s_1} + \Delta s \beta_{s_1} X_{s_1} \\ \cdots &\quad \cdots \quad \cdots \quad \cdots \\ \beta_{s_M} X_{s_M} &\approx \beta_{s_{M-1}} \ X_{s_{M-1}} + \Delta s \ \beta_{s_{M-1}} \ X_{s_{M-1}} \end{align}$$
plug in the SDE $$X_{t_{i+1}} = X_{t_i} + \alpha(t_i) \beta_{s_M} \ X_{s_M} \ \Delta t + b(X_{t_i}, t_i) \Delta W_{t_i}$$
Is the above correct???