I only slightly adapted what you already had so I'll explain my changes.
if ($isfile(bank.txt)) { .remove bank.txt }
This will check if the file 'bank.txt' already exists and remove it if it does. This is so that the previously sorted top10 list is removed before the script runs.
This is a variable that keeps track of what number in the top 10 we're currently on. It is later increased by one each time the _top10 alias runs.
I used /inc -u to set a global variable that unsets itself rather than /var because this effectively creates a local variable, but it does not unset itself until after both the local scope and all of the aliases it calls have finished running. So it's like a wider local variable, if you know what I mean.
filter -cetuwk 2 32 @all _top10
This is no different to what you had before, except that rather than writing directly to the file, it passes the filtered content onto the /_top10 alias, which you can see below.
alias -l _top10 {
tokenize 32 $1
write bank.txt %top10_n $1 $bytes($2,b)
inc %top10_n
}
This accepts the filtered content and writes it to the bank.txt file, along with the current top ten number (%top10_n) and it also uses $bytes(,b) to format the numbers from within the top10 list.
Hope that helps