Representation of a martingale as a stochastic integral Let $\xi_{1},\xi_{2},\dots$ be an i.i.d. sequence that takes values $\pm 1$ with equal probabilities. Define the simple symmetric random walk with $X_{0}=0$, and $X_{n}=\sum_{i=1}^{n}\xi_{i}$. Define the filtration $\mathcal {F}_{n}=\sigma\left(X_{1},\dots, X_{n}\right)=\sigma(\xi_{1},\dots,\xi_{n})$. Let $\mathcal {F}_{\infty}=\sigma\left(\cup_{n=1}^{\infty}\mathcal {F}_{n}\right)$.
Let $T\in \mathcal {F}_{\infty}$ be an integrable random variable. I want to show that there is a martingale sequence ($M_{n},n\in \mathbb {N}$) such that $M_{n}\to T$ almost surely.
Furthermore, I can always write $M_{n}$ as
$$
M_{n}=\mathbb {E}(T)+\sum_{i=1}^{n}A_{i}\left(X_{i}-X_{i-1}\right),
$$
for some predictable sequence $(A_{i},i\in \mathbb {N})$. Seeking for some hints on doing both.
 A: We follow Chapters 13 and 14 in David Williams' book "Probability with martingales". The outline will be similar to @jro's comment.
Step 1. Let $M_n := E[T | \mathcal{F}_n]$. Then, $(M_n, \mathcal{F}_n)$ is a martingale. We remark that $E[|M_n|] \le E[|T|] < +\infty$ for every $n  \ge 1$.
Hence we can apply the martingale convergence theorem and we have that there exists an integrable random variable $M$ such that $M_n \to M$, $P$-a.s.
Step 2. We will show that $M_n \to M$ in $L^1$, that is, $E[|M_n - M|] \to 0, \ n \to \infty$. By the definition of $M_n$, the family $\{M_n\}_n$ is uniformly integrable. It is well-known that this and Step 1 imply the $L^1$ convergence. (Theorem 13.7 in Williams' book)
Step 3. We will show that $M = T$, $P$-a.s.  Let $n \ge 1$ and $A \in \mathcal{F}_n$. Then, by using that $\mathcal{F}_n \subset \mathcal{F}_k$ for $k \ge n$, $E[T, A] = E[M_k, A]$ for every $k \ge n$. By Step 2, $E[M,A] = \lim_{k \to \infty} E[M_k, A] = E[T,A]$.
Let $\mathcal{L} := \left\{A \in \mathcal{F}_{\infty} | E[M,A] = E[T,A] \right\}$. This is a $\lambda$-system, and by the argument above, $\cup_{n \ge 1} \mathcal{F}_n \subset \mathcal{L}$. Since $(\mathcal{F}_n)_n$ is a filtration, $\cup_{n \ge 1} \mathcal{F}_n$ is a $\pi$-system.
Now, by the Dynkin $\pi$-$\lambda$ theorem, $\mathcal{L} = \mathcal{F}_{\infty}$. Since $T$ and $M$ are both $\mathcal{F}_{\infty}$-measureble, we obtain that $M = T$, $P$-a.s.
