The Messenger of Allah ﷺ used to pray two rakʿahs following every prescribed prayer, except Fajr and ‘Asr. (Using translation from Aḥmad 1226)
كَانَ رَسُولُ اللهِ ﷺ يُصَلِّي رَكْعَتَيْنِ فِي دُبُرِ كُلِّ صَلَاةٍ مَكْتُوبَةٍ إِلَّا الْفَجْرَ وَالْعَصْرَ