Mantras are based on sound (vibration). If the mantra is pronounced correctly it will create a certain vibration and that vibration sets in motion actions that deliver a certain result.
You cannot 'change' a mantra to do something else. All mantras must be pronounced correctly to deliver the correct result. If not pronounced correctly, some mantras will not deliver any result. Some mantras if not pronounced correctly will deliver harmful results.
Think of when a song is sung. When it is done by a well trained voice, it can create subtle good feelings in those that hear it. Obversely, when the same song is sung by someone that is say, tone deaf, people turn away in pain. Same song, different vibrations being generated.
There's no 'magic' involved.