is it necessary to connect all 32 LEDs (solenoids) to the 32 outputs of the registers in order to get the code working right?
No the code will work anyway.
The code always works. Whether it does what you want is another matter.
void outputBytes(){
Is totally wrong.
shiftOut(data, clock, MSBFIRST, dataValues);
shifts out all 8 bits of data.
It is in a for loop that does it 8 times, so that is 64 bits you are outputting.
Then each time through the loop you do this:-
dataValues = dataValues << 1; // Shift the bits one place to the left
which alters the data you put out.