Hi Ravindra Balsaraf,
I have test our SDK flash project in our TWR-KM34Z75M board, it works OK, TWR-KM34Z75M chip is just MKM34Z256VLQ7, the same chip as you.
1. Please download the newest SDK code from this link:
Welcome | MCUXpresso SDK Builder
Chose the TWR-KM34Z75M board, then generate the code and download it.
2. open the project in folder: SDK_2.2_TWR-KM34Z75M\boards\twrkm34z75m\driver_examples\flash
3. Please check my following test result, you can find sector erase is correct, it won't erase the whole flash block.





You can find other flash address also have data, so the flash sector erase works OK.
I have checked your code, you have the following definition:
uint32_t pflashBlockBase = 0; //Defined
uint32_t pflashTotalSize = 0x40000; //Defined
uint32_t pflashSectorSize = 0x100; //Defined and all these values are stored in *value by switch case
Please note, the Flash sector size in MKM34Z256VLQ7 is 2KB, it is 0X800, you can't define it as 0x100, even you define it as 0x100, it will still erase the 0x800 flash sector.
Please check the reference manual:

So, I highly recommend you check the KSDK sample code on your side directly.
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------