Katie Arrington engineered one of the major upsets of the Republican primary season when she defeated Representative Mark Sanford, a former South Carolina governor, in June. But Democrats and their nominee, Joe Cunningham, turned the tables on her, winning the general election, by persuading voters that Ms. Arrington’s politics are too far right for a district whose outgoing congressman has been a persistent critic of President Trump.