Let $\lambda=l^*$ denote Lebesgue measure on $\Bbb R$, and let $A$ be a Lebesgue measurable set with $\lambda(A)\lt +\infty$. Show that if $\epsilon \gt0$, there exists an open set which is the union of a finite number of open intervals such that $$||\chi_A-\chi_G||_1=|\lambda(A)-\lambda(G)|\lt \epsilon$$
Also, if $\epsilon \gt0$ there exists a continuous function $f$ such that $$||\chi_A-f||_1=\int |\chi_A-f| d\lambda\lt \epsilon$$
I already showed that $$l^*(A)=inf\{l^*(G):A\subseteq G, \text{G is open}\}$$ $$l^*(A)=sup\{l^*(K):K\subseteq A, \text{K is compact}\}$$, but I'm not sure if these could help prove the above proposition. Could someone provide a complete proof please? Thanks.
Here is a sketch. Fix $\epsilon>0$. Because you know $$\lambda(A)=\inf\{\lambda(G):A\subset G\mbox{ open}\}$$ and $$\lambda(A)=\sup\{\lambda(K):A\supset K\mbox{ compact}\},$$ you know there is $K\subset A\subset G$ with $K$ compact and $G$ open such that $\lambda(A\setminus K)<\frac{\epsilon}{2}$ and $\lambda(G\setminus A)<\frac{\epsilon}{2}$.
Because $G\subset\mathbb{R}$ is open, we can write $G$ as a disjoint union of open intervals, $G=\bigcup_{i\in I}U_i$. So $\{U_i\}_{i\in I}$ is an open cover of $K$, whence by compactness of $K$ it has a finite subcover $\{U_1,\ldots,U_n\}$. Set $H=U_1\cup\cdots\cup U_n$. Then as $K\subset A,H\subset G$, you know $\lambda(K)\leq \lambda(A),\lambda(H)\leq G$, so that $|\lambda(A)-\lambda(H)| < \epsilon$. (In fact, $\lambda(A\Delta H)<\epsilon$, where $\Delta$ is symmetric difference.)
To define $f$ in the case $A=(a,b)$, simply let $f_\delta$ be zero in $(-\infty,a-\delta]$, linearly rise from $0$ to $1$ in $[a-\delta,a+\delta]$, be $1$ on $[a+\delta,b-\delta]$, go down to $0$ in $[b-\delta,b+\delta]$, and stay $0$ forevermore. As you take $\delta$ as small as you'd like, $\|\chi_A-f_\delta\|_1$ gets as small as you'd like. For general $A$, approximate $A$ with a finite union of disjoint intervals, and approximate it by a finite sum of such $f$'s with an $\frac{\epsilon}{n}$ argument.