I've made configuration in YAML file which will copy flows_cred.json file when it container restarts so that credentials don't get wipe out but now another file flows_cred.json.$$$ is getting generated even if i remove this files it gets created back and not able to deploy the flow and getting below error
Flushing file flows_cred.json to disk failed : Error: EBUSY: resource busy or locked, rename 'flows_cred.json.$$$' -> 'flows_cred.json
Looks to me as though you've got a separate process that is locking the flows_cred.json file. So when Node-RED tries to flush the data that needs to be in that file to disk via the temporary file that ends with $$$ (most likely a safety measure to ensure no data loss or race conditions), it can't do it because the actual live file which presumably should have been removed, is still there or locked.
Look to your copy process because that will be what is causing the issue.