Maximum number of SN74HC165N

else
{
  //Serial.print("0");
  index = i;
  value = LOW;
  //setRegisterPin(index, value);
}

Why is that setRegisterPin() call commented out?
What was the behavior/issue before you commented it out?

Right now, you can turn outputs high by setting the corresponding input high, but it doesn't go low again when the input goes low. Putting that line back in place should make it go low. Is this not what you were seeing?