The Massachusetts Republican Party settled a lawsuit Friday tied to work done by an outside marketing firm during the 2022 election but quickly found itself entangled in new cash and legal woes just ahead of the November election, according to a letter obtained by the Herald.