Hello Sathwik,
Which program are you using to try this? I recommend you to try this with an example of the SDK. I just try the rit_example of the SDK with Flash magic and everything worked well.
How are you generating the .hex file? In the folder of your project in the project explorer window of MCUXpresso you can select DEBUG then right click on the .axf file > binaries utilities > create hex.
Hope it helps!
Victor.