how to end an assembly code
Just to make it clear: in microcontroller assembly code there usually isn't an end. There certainly isn't an end instruction. There isn't an OS to return control to, and there's no way to just "stop".

Microcontroller code nearly always contains an infinite loop.