mIRC has a built-in limit of around 950 chars for the length of a "string".
There are a couple of answers to the issue, but all require a rework of how you do your sort - i.e. you cannot use $sorttok() (which is what I assume you're using)
Binvars store data in binary format, and are limited only by the size of your memory.
Hash tables used as a list (i.e. each element holds one of the tokens that you would put in your string)
Each of these methods obviously requires you to write your own sort routine.