in normal words, what's the end goal of this? is this supposed to show the 1st 10 bans in a channel?
$comchan is intended to identify the channels you share with some other nick, so $comchan shared with $me is basically the same thing as $chan(%i).
What your code ends up doing is showing the 1st ban of your 1st channel, the 2nd ban of your 2nd channel, etc