It follows from the fact that $1_{B_k}$ is $\mathcal{F}_{n-1}$-measurable for $k \leq n-1$ that
$$\mathbb{E}(X_n \mid \mathcal{F}_{n-1}) = X_{n-1} + \mathbb{P}(B_n \mid \mathcal{F}_{n-1}).$$
Subtracting $A_n := \sum_{k=1}^n \mathbb{P}(B_k \mid \mathcal{F}_{k-1})$ on both sides yields
$$\mathbb{E}(X_n - A_n \mid \mathcal{F}_{n-1}) = X_{n-1} - A_{n-1}.$$
This shows that $M_n := X_n-A_n$ is a martingale. Consequently, the Doob decomposition is given by
$$X_n = \underbrace{\sum_{k=1}^n 1_{B_k}-\mathbb{P}(B_k \mid \mathcal{F}_{k-1})}_{\text{martingale}}+ \underbrace{\sum_{k=1}^n \mathbb{P}(B_k \mid \mathcal{F}_{k-1})}_{\text{predictable}}.$$