The former president tried for months to avoid testifying in the New York Attorney General Letitia James’ investigation.