Trump to appear in court, accused of endangering US democracy