You can't leave the country until you have your approved travel document in hand, so you should expect to spend the 3–5 months after submitting your green card application in the United States. Theoretically, you could be out of the United States for as long as you have a travel document (one year plus renewals).