I have turn on 16 LEDs one by one using two 74HC595 shift register. I have some doubt regarding my code and need some help

Yes, but not using shiftOut(), as already explained.

This code (untested) uses hardware SPI and can send all 16 bits in a single call.

With shiftOut(), you can use any pins you like, but with hardware SPI the pins are fixed and depend on the model of Arduino you are using. I have assumed you are using Uno R3 or similar Arduino based on ATMEGA328.

#include <SPI.h>

// ST_CP pin 12
const int latchPin = 10;
// SH_CP pin 11
const int clockPin = 13;
// DS pin 14
const int dataPin = 11;

void setup() {
  // Configure pins as outputs
  pinMode(latchPin, OUTPUT);
  SPI.begin();
  SPI.beginTransaction(SPISettings(10000000, LSBFIRST, SPI_MODE0));
}

void loop() {
  for (int i = 0; i < 16; i++) {
    uint16_t LED = 1 << i;

    digitalWrite(latchPin, LOW);
    SPI.transfer16(LED);
    digitalWrite(latchPin, HIGH);

    delay(1000);
  }
}

See this page for the pins to use for other models of Arduino:

https://docs.arduino.cc/language-reference/en/functions/communication/SPI/