I am working on yocto, I want to compile some C files in yocto and install the resulting binary to external filesystem. Before doing that I tried creating a separate reciepe
You can just go to the official documentation to find your answer.
The very first example is exactly what you need.