Why are you messing around setting/unsetting vars?
Just echo the info straight to the relevant channel.
Code:
raw *:* {
  haltdef
  if ($numeric == 332) {
    echo $2 $+([,$2,] Topic $chr(40),$3-,$chr(41))
  }
  elseif ($numeric == 333) {
    echo $2 $+([,$2,] Set by $chr(40),$3,$chr(41) At $chr(40),$asctime($4),$chr(41))
  } 
}