The late endorsement by the powerful Brooklyn congressman marks a significant shift of mainstream Democrats corralling around Mamdani.