Suppose $f \in L(X, M , \mu)$ and $g$ is a $M$-measurable real-valued function such that $f(x) = g(x)$ $\mu$-almost everywhere on $X$. I want to show that $g \in L(X, M, \mu)$ and for all $A \in M$ $$ \int_{A}f\,d\mu = \int_{A}g\,d\mu $$
I know $f$ is integrable iff $\int|f|$ is finite. Same for $g$. $E=\{x:f(x)=g(x),x\in X\}$.
Then $\int |g|d\mu= \int_E |g|d\mu +\int_{E^c} |g|d\mu = \int_E |f|d\mu < +\infty$.
So $g$ is integrable? But I am not sure how go on to show the second part?
You have practically already solved it. Recall that one possible definiton of $\int_Ef$ is the supremum of aproximating $R(f,E)$ the graph of $f$ under over $E$. In particular, this lets us see that if $\mu(E) = 0$ then $\int_E f = 0$.
Thus, since
$$ X = \{f = g\} \stackrel{d}\bigcup \{f \neq g\}$$
we have that, noting $E = \{f=g\}$,
$$ \int_Af \ d\mu = \int_X\chi_Af \ d\mu = \int_E\chi_Af \ d\mu + \int_{E^c}\chi_Af \ d\mu = \int_E\chi_Af \ d\mu = \int_E\chi_Ag \ d\mu = \\ = \int_E\chi_Ag \ d\mu + \int_{E^c}\chi_Ag \ d\mu = \int_X\chi_Ag \ d\mu = \int_Ag \ d\mu. $$