Observations of high-velocity molecular gas near Herbig-Haro objects: HH 24--27 and HH 1--2