Not able to get IP using BG95 Moderm

I am using BG95 moderm with firmware version : BG95M3LAR02A03_01.012.01.012.

I am using following sequences of AT command

[ATE0]<<<<<
[AT&D0]<<<<<
[AT+QURCCFG=“urcport”,“uart1”]<<<<<
[AT+CFUN=1]<<<<<
[AT+COPS=3,2]<<<<<
[AT+CREG=2]<<<<<
[AT+CGREG=2]<<<<<
[AT+CEREG=2]<<<<<
[AT+CTZR=1]<<<<<
[AT+QSIMSTAT?]<<<<<
[AT+CFUN=1]<<<<<
[AT+CREG?]<<<<<
[AT+CGREG?]<<<<<
[AT+CEREG?]<<<<<
[AT+COPS?]<<<<<
[AT+CREG?]<<<<<
[AT+CGREG?]<<<<<
[AT+CEREG?]<<<<<
[AT+COPS?]<<<<<
[AT+CREG?]<<<<<
[AT+CGREG?]<<<<<
[AT+CEREG?]<<<<<
[AT+COPS?]<<<<<
[AT+CREG?]<<<<<
[AT+CGREG?]<<<<<
[AT+CEREG?]<<<<<
[AT+COPS?]<<<<<
[AT+CREG?]<<<<<
[AT+CGREG?]<<<<<
[AT+CEREG?]<<<<<
[AT+COPS?]<<<<<
[AT+CREG?]<<<<<
[AT+CGREG?]<<<<<
[AT+COPS?]<<<<<
[AT+QIACT=1]<<<<<
[AT+CGPADDR=1]<<<<<
[AT+QIDNSCFG=1,“8.8.8.8”]<<<<<
[AT+CCLK?]<<<<<
[AT+QCSQ]<<<<<
[AT+QIOPEN=1,0,“TCP”,“35.172.39.74”,8883,0,0]<<<<<
[AT+QISEND=0,120]<<<<<
[AT+QISEND=0,120]<<<<<
[AT+QISEND=0,12]<<<<<
[AT+QIRD=0,5]<<<<<
[AT+QIRD=0,5]<<<<<
[AT+QIRD=0,91]<<<<<
[AT+QIRD=0,5]<<<<<
[AT+QIRD=0,5]<<<<<
[AT+QIRD=0,1500]<<<<<
[AT+QIRD=0,1500]<<<<<
[AT+QIRD=0,1500]<<<<<
[AT+QIRD=0,897]<<<<<
[AT+QIRD=0,5]<<<<<

It has been observed that some time i am able to get ip and most of the time i won’t . My program retry for certain no try and then stop.

Please let me know incase i need to include any other at command to get ip every time i run the above sequence.

Please execute the following AT Commands in order

AT+CFUN=0
AT+CGDCONT=<>,<> //Configurate APN
AT+CFUN=1
AT+CPIN?
AT+COPS?
AT+QENG=“servingcell”
AT+CEREG? //if return 1,continue
AT+CGPADDR