The Martingale-Part of the Doob decomposition for a stochastic process $(X_n)_n$ and filtration $(\mathcal F_n)_n$ is $$M_n=X_0+\sum_{k=1}^n\bigl(X_k-\mathbb{E}[X_k\,|\,\mathcal{F}_{k-1}]\bigr)$$ (see e.g. here).
I want to prove that this is indeed a Martingale and suceeded by showing $$\mathbb E[M_n-M_{n-1}| \mathcal F_{n-1}] =0$$. However, I failed to show $\mathbb E[M_n| \mathcal F_{n-1}] =M_{n-1}$ and wanted to know where my mistake is.
My attempt is: $$\mathbb E[M_n| \mathcal F_{n-1}] = X_0 + \sum_{k=1}^n(\mathbb E[X_k | \mathcal F_{n-1}] - \mathbb E\big[ \mathbb E[X_k | \mathcal F_{k-1}] | \mathcal F_{n-1}\big]) = (*).$$
Now, note that for $k<n$: $$ \mathbb E\big[ \mathbb E[X_k | \mathcal F_{k-1}] | \mathcal F_{n-1}\big]) = \mathbb E[X_k | \mathcal F_{n-1}] = X_k,$$
and for $k=n$: $$\mathbb E\big[ \mathbb E[X_k | \mathcal F_{k-1}] | \mathcal F_{n-1}\big]) = \mathbb E[X_n | \mathcal F_{n-1}],$$ so that all terms of the sum in $(*)$ are 0. Therefore, we get
$$(*) = X_0.$$
However, we should get $(*) = M_{n-1}$.
Where am I making my mistake?
To prove the martingale property (you also have to show $(\mathscr{F}_n)_{n \in \mathbb{N}_0}$-adaptedness and integrability) it is sufficient to notice that $M_n-M_{n-1}=X_n-E[X_n|\mathscr{F}_{n-1}]$ so that if you take the conditional expectation wrt $\mathscr{F}_{n-1}$ we get $E[M_n-M_{n-1}|\mathscr{F}_{n-1}]=0$ because $E[X_n|\mathscr{F}_{n-1}]$ is, of course, $\mathscr{F}_{n-1}$-measurable.
Your mistake lies into claiming $E[E[X_k|\mathscr{F}_{k-1}]|\mathscr{F}_{n-1}]\stackrel{(?)}{=}E[X_k|\mathscr{F}_{n-1}]$. This is not true: note that $k\leq n$ so all $E[X_k|\mathscr{F}_{k-1}]$ are $\mathscr{F}_{n-1}$-measurable. So the equality is in fact $E[E[X_k|\mathscr{F}_{k-1}]|\mathscr{F}_{n-1}]=E[X_k|\mathscr{F}_{k-1}]$. Also note that all $X_k,k\leq n-1$ are $\mathscr{F}_{n-1}$-measurable, but $X_n$ is not. So we have $$\begin{aligned}E[M_n|\mathscr{F}_{n-1}]&=X_0+(E[X_n|\mathscr{F}_{n-1}]-E[E[X_n|\mathscr{F}_{n-1}]|\mathscr{F}_{n-1}])+\sum_{k\leq n-1}(X_k-E[E[X_k|\mathscr{F}_{k-1}]|\mathscr{F}_{n-1}])=\\ &=X_0+0+\sum_{k\leq n-1}(X_k-E[X_k|\mathscr{F}_{k-1}])=\\ &=M_{n-1}\end{aligned}$$