Question regarding mesh and Cauchy Criterion for integration
As you suspect, your proof is not valid.
By your construction of the set $M$, if $P$ is a partition such that $U(f,P)−L(f,P)<\epsilon$ then $mesh(P) < \delta$. The converse is not immediately true. (If $A \Rightarrow B$, then it does not follow automatically that $B \Rightarrow A$.)
By asserting that $mesh(P) < \delta$ now implies $U(f,P)−L(f,P)<\epsilon$ you are making a circular argument. A correct proof requires a bit more work.
If $f$ is integrable on $[a,b]$ with integral $I$, then there is a partition $P_\epsilon$ such that $U(f,P_\epsilon) < I + \epsilon/4$. (The integral is the greatest lower bound of upper sums).
Let $D = sup\{|f(x)-f(y)|:x,y \in [a,b] \}$ denote the maximum oscillation of $f$ and let $\delta = \epsilon/4mD$ where $m$ is the number of points in the partition $P_\epsilon$.
Now let $P$ be any partition with $mesh(P)<\delta$. Form the common refinement $Q = P \cup P_\epsilon$.
You will see that the upper sums $U(f,P)$ and $U(f,Q)$ differ at at most $m$ sub-intervals and at each the deviation is bounded by $\delta D$.
It follows that $U(f,P)<U(f,Q) + \epsilon/4 < U(f,P_\epsilon)+\epsilon/4<I + \epsilon/2$.
By a similar argument, you can show $L(f,P)> I - \epsilon/2$. Hence $U(f,P)-L(f,P) < \epsilon$.