You just create a folder inside your home assistant directory. /.homeassistant/custom_components
Here, the name of the folder should match the component you want to overwrite. Home Assistant will load these last.
So create /.homeassistant/custom_components/lg_soundbar folder and plop the new init, manifest and media_player files in here, then restart home assistant.
Once you want to revert back to the original one, you can just delete this folder and restart.