score:19
John VI Kantakouzenos
John VI Kantakouzenos, who reigned from 31 March 1347 to 10 December 1354, is the emperor who comes closest to meeting your criteria. He was deposed by his co-emperor John V Palaiologos (for whom he had earlier acted as regent), adopted the name Joasaph Christodoulos and wrote a History:
After he had been forced to retire, Emperor John VI Kantakouzenos (1347– 1354) wrote a history in which he tried to explain his actions throughout his career. It is an account of political and military affairs, primarily covering the years 1320– 1356 in four books. At over 1,700 pages in the Bonn edition for a span of thirty- six years, it is a highly detailed history. The History is the only surviving history written by an emperor concerning his own reign.
Source: 'John VI Kantakouzenos', chapter 41 in Leonora Neville, 'Guide to Byzantine Historical Writing' (2018)
Details on publications of Historiarum can be found here. Among them are a PhD thesis, An Annotated Translation of John Kantakouzenos’ Histories, Book III, Chapters 1-30 by Brian Steven McLaughlin (pdf).
Other works attributed to the ex-emperor include
a commentary on the first five books of Aristotle's Ethics and several controversial theological treatises, including a defense of Hesychasm and a work Against Mohammedanism printed in Migne.
The commentary on Aristotle is disputed, though, and Neville (2018) states that "the current consensus is that he did not" write it.
As MAGolding has noted in a comment, John VI was periodically involved in Byzantine ecclesiastical affairs after his removal. However, between 1379 and 1381, he was held in captivity. Upon his release, he settled in Mistra in the Peloponnese where he died in 1383, aged 90 or 91.
The only other deposed emperor who seems to have written anything is Maurice. He ruled from the 14th of August 582 until he was deposed and executed on the 27th of November 602. The Strategikon of Maurice may have been written by him but, if so, this was during his reign:
The Strategikon, generally but possibly mistakenly attributed to the emperor Maurice (582–602 CE), is one of the most extensive extant treatises on military tactics and strategies before the early modern period, and is the basis for much of what we know about the sixth-century Roman army. The treatise was written sometime after 580 and before 610. An anonymous military engineer or general officer, the general Philippikos, the brother-in-law of the emperor Maurice, and the emperor Maurice himself are all plausible candidates as author.
Source: David Olster, 'Strategikon of Maurice' in 'The Encyclopedia of Ancient History' (2013)
Other known 'emperor-authors' are Leo V the Armenian (813 to 820), Leo VI the Wise (886 to 912), Constantine VII (reigned 913 to 959), and Theodore II Laskaris (1254 to 1258). None of these, though, come close to meeting your criteria as they died as emperors.
Of the emperors who were deposed, most were killed immediately or within a few days of losing power. Of the remainder, most did not live more than a year or two after their reigns ended. A few, such as Leontios (reigned 695 - 698) and Alexios III Angelos (1195 -1202) lived several years after being deposed but I can find no evidence that they authored any works. Another 'survivor', Romanos I Lekapenos (920 to 944) was described as "an idiot and an illiterate man" by his co-emperor and eventual successor Constantine VII (though Constantine was probably exaggerating as he had reasons for disliking Romanos). Finally, a few virtually disappeared from the historical record, even their date of death uncertain.