This is completely unnecessary.
All batteries packs have a something called a battery protection circuit which is designed to disconnect the battery from the charging source once it reaches full capacity and disconnect from the load once it drops to a certain voltage. Below is a photo from a (circa 2007 MacBook) battery that has been disassembled.
Battery Health Management
With the release of Catalina (10.15.5) this is now even more unnecessary as this "battery preservation" technology is now baked into the OS; it's called Battery Health Management. The way it works is that it reduces the maximum charge while plugged in. The battery icon may show "Not charging" and will discharge to around 93% even with the charger connected before charging again. See Apple Support Document About battery health management in Mac notebooks.
When you overcharge a battery, you could damage it and cause it to burn. Without this protection circuit, at minimum you would be drastically shortening the life of your battery and at worst, starting a fire (thermal runaway).
There is an excellent YouTube video that shows how a protection circuit works through building one. There's also an excellent article on HowStuffWorks; Can your laptop battery be overcharged?