How about:
/write -dl $+ $readn masks.txt

If you write -dl$readn, I won't work, cause mIRC doesn't recognize the $readn


When you write -dl$readn, mIRC doesn't know what you want, and $readn in this cause will be Null, so you actualy wrote

/write -dl masks.txt

Note: You can't write anothing at the left side of a $something (It will cause it to not recognize the $something), but you CAN write $somethingsomethingelse . For example:

If $readn was 3 then
//echo -a $readn.hello
will return 3.hello

and
//echo -s hello.$readn
Will return hello.