Baking out textures involves two easy steps.
The user should supply UVs (UV mapped) for the object to be baked.
Set Bake Hider
Instead of using raytrace, set it to bake.
In your RIS Network, add a PxrBakeTexture VOP. Wire its output to a PxrSurface color parameter so it will get evaluated.
In the PxrBakeTexture VOP, set its output FileName. See PxrBakeTexture for descriptions of each parameter.