You get this error because you instantiate new module logics. Instead, you need to use the existing, properly initialized module logic. For example: colorLogic = slicer.modules.colors.logic() .
WriteData: removing old version of file /root/output/52591e24-6ccd-4ae5-afd9-b689d1375291/4_ISOCENTER_VERIFICATION.nrrd
This is because you don’t have write access to that file. It is either because you don’t have write access to that folder or something locks that particular file. On linux a common issue was that sharing a single slicer instance between multiple users could result in having a read-only temporary folder. You can set the temporary folder path manually to fix this, or use the latest Slicer Preview Release, which automatically requests a new temporary folder from the operating system if the current folder is read-only.