after using this code once,
I used it for about 20 seconds before I shut it off.
The card's controller has wear leveling.
A Mac may format a card with GPT format instead of MBR format.
The SD Formatter was created specifically for memory cards using the SD/SDHC/SDXC standards. It is strongly recommended to use the SD Formatter instead of formatting utilities provided with operating systems that format various types of storage media. Using generic formatting utilities may result in less than optimal performance for your memory cards.
The flash controller in an SD card is a very sophisticated device with a powerful micro-controller. It doesn't work in the simple way you describe.
We should be asking about the user's hardware setup.