Generalized connected sum construction for nonzero constant scalar curvature metrics