For which positive integer values of $n$ does $a|mn-b?$

I am taking a number theory class, and I was not able to solve this homework problem.

Let $a,$ $b,$ and $m$ be constant positive integers. For which positive integer values of $n$ does $a|mn-b?$

I tried this out for a couple of values, and the values of $n$ satisfying this expression seem to occur in a cycle. (For example, let $m=2019,$ $a=20,$ $b=19.$ The values of $n$ that work are $1,21,41,61,....$) However, I am not able to show that this always happens.


Let $\,d = \gcd(a,m).\,$ $\ d\mid m\ $ & $\ d\mid a\mid nm\!-\!b\,\Rightarrow\,\color{#c00}{d\mid b}\,$ so $\:\!\color{#90f}{{\rm cancelling}\ d}\,$ from the divisibility

$$ a\mid nm-b\!\!\overset{\large\color{#90f}{\div\ d_{\phantom{.}}}\!\!}\iff a/d\mid n(m/d) - b/d\iff n\equiv \dfrac{\color{#c00}{b/d}}{\color{#0a0}{m/d}}\!\!\!\pmod{a/d}\qquad$$

i.e. to evaluate a (multivalued) modular fraction $\, n\equiv b/m\pmod{\!a},\,$ cancel $\,d = \gcd(a,m)\,$ everywhere, i.e. from the top $\,b\,$ & bottom $\,m\,$ & modulus $\,a\,$ (if $\,\color{#c00}{d\nmid b}\,$ then it does not exist, by above). Notice that $\,\gcd(a/d,m/d) = 1\,$ so $\,\color{#0a0}{(m/d)^{-1}}$ exists $\!\pmod{\!a/d}\ $ (e.g. by Bezout).

See here for much further discussion (including how to use such multivalued modular fractions in the extended Euclidean algorithm)