If you are confused on the math behind sorting a set of numbers, you can google "array sort algorithm" and get lots of good information about different ways to sort stuff.
If you are confused on how to implement such an algorithm in the sc2 editor, there is actually a templete by blizzard. In the trigger editor, click view and make sure "Show Libraries" is check. Then open Built-In>Template>Algorithms to see some example actions that sort an array of scores. You can also just search your question on this website to find other threads about this.