Ulrich Luz discusses the doxology in Matthew 6:13; argues that it was not original to Matthew's Gospel but a doxology was prayed when the Lord's Prayer was recited by the earliest Christians; there is Old Testament precedent for the form of the doxology.
Ulrich Luz, Matthew 1–7: A Commentary on Matthew 1–7, rev. ed. (Hermeneia—a Critical and Historical Commentary on the Bible; Minneapolis, MN: Fortress Press, 2007), 323 (Logos ed.)
The three-part doxology that is common in our worship services does not appear in the best manuscripts. In its basic type it is based on 1 Chr 29:11 and is documented in the NT in many variations.136 However, 2 Tim 4:18 and the two-part doxology of Did. 8.2, customary in the Didache (10.5), show that in the Greek church the Lord’s Prayer was prayed with a doxology from the very beginning. Jewish prayers are also inconceivable without a concluding doxology. There is a certain freedom with regard to the wording of private prayers, which makes it understandable why one did not need to write down the doxology. In the older witnesses that contain the doxology there is a great deal of variety in the shape of the text.