Move last 100 messages in mailbox

In Apple Mail, I am trying to write a script that simply moves the last 100 messages (pref the last 100 OLDEST messages) to another box. I can get it to move messages, and I can get it to move based on date, but not on the count.

Any ideas on a repeat statement to accomplish the goal?

Thanks for your time!

Hi. The index correlates to the age of receipt.

tell application "Mail" to move account "whatever"'s mailbox "INBOX"'s messages -100 thru -1 to mailbox "wherever"