Sequence: recitation outside prayer, no prostration yet, recitation of the same verse inside prayer, then prostration there. The one performed act covers both occurrences.
This is a specific ruling involving the same verse and a previously unfulfilled obligation, not a blanket rule for all verses and gatherings.