Praise be to Allah.
Divorce in writing does not count as such unless the husband intends it as such. If he writes a divorce to his wife but he did not intend to divorce her, then divorce does not take place according to the majority of scholars, and this was the view favoured by Shaykh Muhammad ibn Ibraaheem and Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allaah have mercy on them).
This has been explained in the answer to question no. 72291. Based on this, the text message that you sent via mobile phone does not count as a divorce because you did not intend it as such.
If a man says to his wife, “You are divorced, you are divorced, you are divorced,” intending thereby one talaaq and only repeating the phrase for emphasis or to make sure his wife understands the words, this only counts as one talaaq, according to the four imams (may Allaah have mercy on them).
See: al-Mawsoo’ah al-Fiqhiyyah (1/221).
Based on this, when you said to your wife “You are divorced, you are divorced, you are divorced,” intending thereby only one talaaq, it counted as one talaaq, and this was the second talaaq.
As her ‘iddah has ended, you cannot take her back, but there is nothing wrong with doing a new marriage contract with her, subject to the usual conditions of marriage: the woman’s consent, and the presence of two witnesses and her wali (guardian), etc.
She can come back to you on the basis of this marriage contract, with the outstanding number of divorces, i.e., there is only one talaaq left with her.
You should help your wife to get rid of this depression by finding out its causes and dealing with them, and by pursuing the means that will help to bring her relief and peace of mind.
And Allaah knows best.