The Sort by Location button's script is quite something. You should look forward to that! But first, we'll start with the Sort by Time button.
on mouseUp global gReminderData set the itemdelimiter to tab sort gReminderData numeric by item 4 of each showdata writedata end mouseUp
LiveCode's sort command is powerful, and in the above case, it is sorting the list of reminders based on the notification seconds value. Once the lines are sorted, the list for the user to see is recreated, and the text file is rewritten.