Replace your # with $1 and ensure that you specify the channel when using the /masskick command.

Using /masskick without a channel will not work.

Also it looks like you're kicking everyone except ops, so here's an alternative
Code:
 alias masskick {
if $1 !ischan { echo -a You aren't on $1 }
elseif ($me !isop $1) { echo -a You don't have ops on $1 }
else {
while $nick($1,0,a,o) {
kick $1 $nick($1,1,a,o) $2-
}
}
}