Sajda-e-Sahw

Forgetting to recite a Surah in the third rakaat of Sunnat Salaah

Q: I performed the four sunnah of Asr salaah however in the 3rd rakaat I forgot to read a Surah after Surah Fatiha only realised this in ruku. I intended to make sajda sahwa but after the 4th rakaat I read the tashahud, durood and dua and made both salaams. Whilst making the second salaam I remembered the sajda-e-sahw and immediately made a sajda after then completed the Salaah. Was I correct or did I have to repeat the Salaah?