The other party started to use a lawyer, and then I retained a lawyer and responded to their letter. But what if they still contact me directly about the matters lawyers are dealing with? What type of wording should I use to write back to them?
Your lawyer will likely advise you to keep direct communication to a minimum. There is good reason for this – they can cherry-pick from what you say, to find only those aspects of your communication that work in their favor, and potentially find ways to spin other aspects of your communication in their favor also. Therefore generally speaking, any communication to them can only improve their case, not weaken it, especially if it's in a written form that's easily presented as evidence (regular mail/email included).
Therefore you will normally be advised to refer communications to your attorney.
Having said that, there are exceptions, for example in a shared custody situation, you cannot ignore everything that your soon-to-be-ex says. Sometimes the child's welfare and logistics require a response. Still keep your responses to the minimum necessary, focused solely on the welfare of the child and what is appropriate and reasonable in the situation.
Show the correspondence to your lawyer and discuss what to do
So, you've both hired lawyers and that means that your respective lawyers will be looking to protect your legal interests. They should, but may not, be protecting your best interests as well which may not be the same thing.
This is not a failing of your lawyer - when you're a carpenter every problem looks like it can be solved with a hammer and nail; when you're a lawyer every problem looks like it can be solved with a lawsuit. You need to be actively involved in resolving the fundamentals of the dispute taking into account the advice of your lawyer who understands the legalities of the dispute.
Right now, you are engaged in dispute resolution. This may lead to a lawsuit but it doesn't have to. In all likelihood, you and your counterpart can both get a better outcome through negotiation or mediation than you will through winner-takes-all litigation. Don't let the fact that lawyers are involved close down your options.
Work out (with your lawyer) what your best alternative to a negotiated agreement (BATNA) is - it may be a lawsuit or it may be you giving the other party everything they want. Lawsuits are expensive, stressful and uncertain and you can lose more than you stand to win. Once you know what your BATNA is, negotiate (with your lawyer's help) to see if you can do better than that.