$chr(0) is nothing therefor you need to start counting at 1, also you need to escape $chr(32) as it cant be printed on it's own.
Code:
alias test {
  var %i = 1
  while (%i <= 255) {
    if (%i = 32) { echo -a space | inc %i }
    echo -a $chr(%i)
    inc %i
  }
}


$maybe