how to switch a data line on and off with a digital output "smallest possible"

due to the way the code works they can only rotate separately unless the corresponding lines to each stepper motor are linked together

Then change the way the code works so you switch all the lines together. Their is no need to add any hardware to do this.