Hi @PriyaMP
1. Please run SDK_2.9.1_EVKB-IMXRT1050\boards\evkbimxrt1050\driver_examples\flexspi\nor\polling_transfer
And share me your test result, please note, this project run from the RAM.

Then send me your printf result. I need to make sure your external QSPI really works OK, and you also enable the QE bit, this is important.
But you mentioned other SDK works, it should has no problem, so just one confirm point to your result.
2. About your attached code
I have one MIMXRT1050-EVKB board which I have modified it to the QSPI flash, then I run your attached project directly , this is my debug result:

you can find, I can enter the debug mode the first time, without your mentioned SWD issues.
Then run it, your code meet fault issues, then the SWD can't be connected.

So, mainly your modified code issues, I think you can do the external memory erase at first, then run the SDK code for this project without modification again, it should works.
From now, your SWD issues are mainly caused by your modified project.
This situation, let's recover your SWD interface at first.
import one SDK evkbimxrt1050_lpi2c_interrupt_b2b_transfer_master_SDK project, then your board enter serial download mode, use the new SDK download, please note, modify the related point to the QSPI interface. you can download, but can't enter the debug mode, it doesn't matter, after code is downloaded, exit the debug mode, then board enter the internal boot mode again, reset the board or repower on it. then download the SDK project again, you will find your SWD is back.
Your main issue is caused by your own modified code, this is the SDK debug result:

You can modified the code again based on the SDK project.
I don't know which detail modified points on the SDK.
I suggest you test the SDK project again without modification, after it works, then you can add your modification step by step.
pinmux refer to the SDK code, add both IOMUXC_SetPinMux and IOMUXC_SetPinConfig for the I2C.
BTW, please also use the new SDK version.
Please follow my advice and try it again.
Any updated information, kindly let me know.
Best Regards,
kerry