Lehmer random number generator - cipher?
Is this type of encryption secure?

Nope (even if you make all the $a_i$ values odd, which you need to make it invertible).
It turns out that there are high probability differentials in this structure; in particular, you have a one-round differential with an input xor difference of (01111...11110) (that is, all bits except the first and last are flipped) and the output xor difference of (01111...11110); this differential holds with probability $&gt; 0.5$.  Because the output differential of round $X$ is the input differential of round $X+1$, the entire differential holds through the entire cipher with probability $&gt; 2^{-10}$