Markey’s opponent, Rep. Seth Moulton, 47, had argued that the Democratic Party needs “a new generation of leadership.”