Recently I was invioved in a legal matter, the other party wrote to my lawyer saying all lies about me, the truth prevailed and came out in court my question is as he said many bad untruths about me can I sue for this
No. The best you could hope for is contempt of court for lying to a court.
Legal matters are generally privileged and not open to a defamation claim unless the lies were published to someone that was not a party to the court case.