If you can guarantee there will be less than 40 users (actually 900 / (max nick length) users) Then this will return a list of all nicks on a specified channel
Code:
alias allusers {
  var %chan = $$1, %i = 1, %nicks
  while ($nick(%chan,%i)) { var %nicks = $addtok(%nicks,$v1,44), %i = %i + 1 }
  return %nicks
}
; This will write all users to a new line in the file channellist.txt
on !*:JOIN:#yourchannel: { write channellist.txt $allusers($chan) }
on !*:QUIT:#yourchannel: { write channellist.txt $allusers($chan) }


If the channel is bigger, it gets more difficult:

Code:
alias writeallusers {
  var %file = channellist.txt
  var %chan = $$1, %i = 1, %n = $nick(%chan,0)
  fopen allusers %file
  if ($ferr) { 
    echo -stc info Problem occurred with opening file $+(%",file,")
    fclose allusers
    return
    }
  fseek allusers $file(%file).size
  while (%i < %n) { 
    fwrite allusers $nick(%chan,%i) $+ ,
    if ($ferr) { 
      echo -stc info Problem occurred writing to file $+(%",file,")
      fclose allusers
      return
      }
    inc %i
  }
  fwrite -n allusers $nick(%chan,%i)
  fclose allusers
}
; This will write all users to a new line in the file channellist.txt
on !*:JOIN:#yourchannel:writeallusers $chan
on !*:QUIT:#yourchannel:writeallusers $chan