All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
You prostrate for forgetfulness after concluding your first prayer with Salaam where you have forgotten something (did a mistake) in the first prayer which is the reason for prostrating for forgetfulness.
The separation by prostration for forgetfulness does not invalidate combining between the two prayers.
Kash-Shaaf al-Qinaa’ authored by al-Bahooti on the conditions for the validity of combining the prayers reads:
"The second [condition] is continuity, so one does not separate between them; i.e. between the two combined prayers; because the meaning of combination is continuity and sequence order, and this is not achieved with a long interruption. If one prays the Rawaatib Sunnan between the two combined prayers and other Sunnan prayers, i.e. between the two prayers that are combined at the time of the first prayer, then this invalidates combining between them, but not if he prostrates for forgetfulness between them even after saying Salaam from the first prayer." [End of quote]
Allah knows best.