It is important that instructions are give to the shift register in the correct order. I have added comments to your code explaining the commands sent to the shift register
void writeRegister(byte n) {
digitalWrite(latchClock, LOW); //get ready to receive data
shiftOut(serialData, shiftClock, MSBFIRST, n);//n : byte //here is the data but don't output it yet
digitalWrite(latchClock, HIGH); //all 8 bytes sent so move the data to the output pins
}
The shift register does not care which Arduino pins you use just that they are taken HIGH/LOW in the right order