Assembly language translation to machine code (process in "RAM")
In modern computers, assemblers do not deal directly with in-RAM machine code anymore. Their job is to translate the textual representation of the assembly language to opcode combinations, in a form that is not completely finished because exact addresses are not decided yet.

Both the tetx and its translation are stored in disk files, they only reside in RAM while translation takes place.

A next step is performed by another utility, the linker, which performs address assignments and creates another file, called the executable, and will also reside on disk.

When you want execution to take place, a third program called the loader will read the opcodes from disk and write them in RAM memory where it belongs. Then the loader will tell the operating system that a new task is ready for execution and eventually control will be passed to the program you have written and which is now loaded in RAM.

(This explanation is really simplified as there are many intervening steps and other goodies to consider.)