Is it possible to overwrite a smart contract used to deploy a bep20 token on testnet? I have made changes to a smart contract already deployed and wish to rewrite the smart contract already present, or will it create a new address once I do this
No. It is not possible to override or upgrade a deployed smart contract, unless you planned and prepared carefully for this scenario.
Yes, If you wrote the contract to be upgradable. This would entail creating a proxy contract that forwards all calls to the implementation contract. This sounds harder than it is, you can use Openzeppelin's plugins to handle all the backend work and all you have to do is write your contract a specific way.
- (explained in their guide: https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable)
To answer the comment you asked in the other answer, yes and no. You can create a contract that has a self destruct function, and then call that function once it is deployed to delete the contract and send any remaining tokens to a specified wallet address. The blockchain is inherently immuatable, so without purposely coding your contract to conteract this immutability, the contract you deployed will always be on the blockchain.