For Mr. Trump, ending the war in Afghanistan has been a focus since taking office, a signature accomplishment that could help him win re-election next year. For nearly a year, Mr. Khalilzad, a former ambassador to Afghanistan, has engaged in talks with the Taliban to make that happen.