Drupal commerce - passing attributes from one module to other
We already have a rule shipped with the drupal commerce core, which creates the user account on checkout process. It might be a good starting point for you in both ways how it is looping through order information to use in your custom module or you can modify the rule as per your requirement.

Rule is "Create a new account for anonymous user."