Hello Prashanth,
If you are looking for the new switch to automatically place itself into the stack then this is not possible. As far as keeping the port and VLAN configuration this is being held by the master and the replacement switch will automatically apply the configuration once added.