I would tell my ex the following:
"Thanks. Thanks for destroying my life, my dignity, my confidence, my respect, my self worth. But most of all, Thanks for giving me the chance to regrow into a better and stronger person because of all the sh!t i been through with you. And thanks for letting me see what hell is really like, because I am now appreciating my life more than ever before!"