Her confirmation puts a longtime ally of Donald Trump at the helm of a Justice Department that has already been rattled by the firings of career employees seen as disloyal to the Republican president.