Don't need PowerShell to do this, if I understand correctly the intent.
--In Studio--
You just create your 2 new Application groups and set the priorities, etc.
Filter the applications by the delivery group they are assigned to.
Select all of the applications and Drag and drop them over on each of the new Application Groups.
Done. You could then remove from the direct assignment of the original delivery group as well, but won't make a difference.