This custom node for ComfyUI allows you to create layers of an image based on input masks and save them into a PSD file.
https://github.com/alessandrozonta/ComfyUI-Layers
git clone https://github.com/alessandrozonta/ComfyUI-Layers
comfy node install comfyui-layers