It is narrated from Abu Marwan (may Allah have mercy on him) that Ka'b (may Allah have mercy on him) swore to him by the One who split the sea for Musa (peace be upon him), saying: "We find in the Torah that the Prophet of Allah Dawud (peace be upon him), whenever he finished his prayer, would make this supplication: 'Allahumma aslih li dini alladhi ja'altahu li 'ismah, wa aslih li dunyaya allati ja'alta fiha ma'ashi. Allahumma inni a'udhu biridaka min sakhatika, wa a'udhu bi'afwika min niqmatika, wa a'udhu bika minka. Allahumma la mani'a lima a'tayta, wa la mu'tiya lima mana'ta, wa la yanfa'u dhal-jaddi minkal-jadd' (O Allah, set right for me my religion which You have made a safeguard for me, and set right for me my worldly life in which You have placed my livelihood. O Allah, I seek refuge in Your pleasure from Your displeasure, I seek refuge in Your pardon from Your punishment, and I seek refuge in You from You. O Allah, none can withhold what You give, and none can give what You withhold, and the wealth and status of one who has wealth and status cannot benefit him at all against You.)"
(Abu Marwan (may Allah have mercy on him)) said: "And Ka'b (may Allah have mercy on him) related to me that Sayyiduna Suhayb (may Allah be pleased with him), the Companion of the Prophet (peace and blessings be upon him), told him that Muhammad (peace and blessings be upon him) used to recite these very words when finishing the prayer."
Imam al-Nasa'i (may Allah have mercy on him) narrated it through Amr bin Sawwad, from Ibn Wahb, from Hafs bin Maysarah.
And also through Muhammad bin Nasr, from Ayyub bin Sulayman, from Abu Bakr bin Abi Sulayman, from Sulayman bin Bilal, from Abu Suhayl bin Malik, from his father, (who) said that Ka'b (may Allah have mercy on him) said.
And also through Harun bin Abdullah, from Sa'd bin Abd al-Hamid, from Abd al-Rahman bin Abi al-Zinad, from Musa bin Uqbah, from Ata' bin Abi Marwan, from his father, from Abd al-Rahman bin Mughith, who related: "Ka'b (may Allah have mercy on him) said."
And also through Ibrahim bin Ya'qub, from Abdullah bin Muhammad al-Nufayli, from Muhammad bin Salamah, from Muhammad bin Ishaq, from Ata' Abu Marwan, from his father, from Abu Mughith bin Amr, that the Prophet (peace and blessings be upon him) (used to recite this supplication).
And Abu Hatim al-Busti (may Allah have mercy on him) narrated it through Muhammad bin al-Hasan bin Qutaybah, from Ibn Abi al-Sari, from Hafs bin Maysarah.
It is possible that Abu Marwan (may Allah have mercy on him) heard it directly from Ka'b (may Allah have mercy on him), since he said to him: "Ka'b swore", and also that he heard it through Abd al-Rahman bin Mughith from Ka'b (may Allah have mercy on him). And regarding Ka'b's (may Allah have mercy on him) statement in the hadith, "We find in the Torah that Dawud (peace be upon him)", it is possible that this is among the things that were inserted into the Torah although they were not part of it, because the Torah came a long time before Dawud (peace be upon him), and this is something quite clear. And Allah knows best.
In the printed edition of Dar Khadir, edited by Abd al-Malik bin Abdullah bin Duhaysh, it reads "(Ata' Abi)", and the correct reading is what has been established in the text; his biography can be seen in the two Tahdhibs and other works.