File.WriteFile used os.WriteFile, which truncates the destination file before writing data. If the write fails (due to quota, full disk, etc.) or the process is interrupted, repositories.yaml is left empty.
Use fileutil.AtomicWriteFile to ensure updates to repositories.yaml are performed atomically via temporary file and rename, matching the behavior of index.go and chartrepo.go.
Signed-off-by: jdymitarai <o10040115@gmail.com>