//write file.txt $+([,%channame,/,%currenttopic,])
or
//write file.txt [[ $+ %channame $+ / $+ %currenttopic $+ ]]
or
//write file.txt $chr(91) $+ %channame $+ / $+ %currenttopic $+ $chr(93)


$+ removes the space you'd normally get, same for $+()
use [[ or $chr(91) for [ if it's surrounded by spaces, if it's not, then you can use [

to get the correct number for $chr, either use $asc(character) to get it or use this script to list them all (put next lines in a file in remotes), then type /chrt somewhere to get a new window with all characters and their codes)
; make a chart with all ascii codes and their hex, oct and decimal codes
alias chrt {
var %i = 0
window -ln @chrt 0 0 125 500
clear @chrt
while (%i <= 255) {
aline @chrt 14 $+ $right(0 $+ $base(%i,10,16),2) $+ 10 $+ $&
$right(000 $+ $base(%i,10,8),4) $+ 08 $+ $base(%i,10,10,4)  $+ $chr(%i)
inc %i
}
window -r @chrt
}