Let $y_n$ be the integer in $\{0,1,\ldots, n-1\}$ such that $a = q_nn+y_n$ for some integer $q_n$; there is exactly one such $y_n$. Then by definition $y_n = a$ mod $n$.
Let $y_m$ be the integer in $\{0,1,\ldots, m-1\}$ such that $a = q_mm+y_m$ for some integer $q_m$; there is exactly one such $y_m$. Then by definition $y_m = a$ mod $m$.
Then note that $a = q_nn+y_n = q_mm+y_m$, and as $m$ divides $n$, it follows that
$a$ can also be written $a = (n/m)q_n m + y_n$ $=q'_n m + y_n$ for $q'_n = (n/m)q_n$; note that $q'_n$ is an integer as both $q_n$ and $n/m$ are integers. So as $a = q'_nm+y_n = q_mm+ y_m$; $q'_n,q_m$ integers, it follows that $(q'_n-q_m)m + (y_m-y_n)$ must be 0, and so $y_n-y_m$ must be a multiple of $m$.
Thus, $y_n-y_m = p_n m$ for some integer $p_n$ [in fact $p_n = q_m-q'_n$], which implies that $y_n$ can be written $y_n = p_n m + y_m$, where $p_n$ is an integer and, as noted earlier, $y_m \in \{0,1,\ldots, m-1\}$. So by definition, (1) $y_m = y_n$ mod $m$.
However, as noted earlier that (2) $y_m = a$ mod $m$ and (3) $y_n = a$ mod $n$, so plugging these into (1) gives $a$ mod $m$ = $(a$ mod $n$) mod $m$.