Depending if the memory is protected, you will have to give yourself permission to write to the specified area, mprotect, and then you can just memcpy over your code to the specified area.
The larger issue you run into when modifying code at runtime is cache coherency
ARM processors have 2 caches that you have to worry about, the ICache (instruction cache) and the DCache (data cache). When you self modify code, you end up changing instructions in the DCache but not necessarily in memory, or more importantly the ICache, therefor these caches become out of sync. You must take some steps to ensure these caches are "clean"/in sync. Flushing the DCache ensures that the changes made in DCache get written to memory.
Flushing the DCache forces the ICache to re-fetch instructions (aka your modified code). On ARM linux there is a syscall call cacheflush
that takes care of this. Depending on how you are modifying memory/in what context, there is an issue of chicken or the egg, as your newly modified code cant contain the cache flush as the caches will already be out of sync, therefor there are other ways to force a cache flush, such as forcing a context switch, i.e. a sleep, when you don't have the ability to programmatically flush the cache.