your use of "thus n|m" is odd because you are given that n|m.

just do this

$a \equiv b (\bmod~ m) \Rightarrow \exists k \in \mathbb{Z} \ni a = km + b$

Now $n|m \Rightarrow \exists j \in \mathbb{Z} \ni m = jn$ so

$a \equiv b (\bmod~ m) \Rightarrow a = jkn + b = (jk)n + b$ and thus

$a \equiv b (\bmod ~n)$