The script has a debugging line in it, which causes those echoes:

echo -a result $owncolor(action)

The result goes into whichever is your active window, which in your case happened to be the channel. It could have been the actual query window, a different query window, the status window, or even could be at a different network.