Trump may be largely ignorant of the US political system, but he has decades of experience with the legal system, through bankruptcies, civil suits, and the like. Trump sees the legal system as a means to delay, harass, and confuse issues, with the ultimate goal of bleeding his opponent dry of time, money, and energy before any actual ruling occurs. Trump will always say that he is willing to give his side — because he always wants to appear as the 'good' person in the dispute — but he will never actually do it unless forced. Giving his testimony means giving the system enough material to draw conclusions and render judgments, which is precisely what Trump seeks to avoid.
For all of Trump's self-delusions and ignorances, he must be aware of how frequently his statements (to put it nicely) diverge from anything resembling observable fact. Even he would think twice about putting himself in a position where lying is actionable. It's one thing to disinform the public on public platforms like twitter; it is an entirely different kettle of fish to disinform sitting senators while under oath.