save json object in there provided json file using javascript/ node js

let obj={
 print:{
  us:{
  "2343192u4":{
     id:"01",
     name:"linux file",
     location:"System config"
    },
   "23438ufsdjh8":{
     id:"02",
     name:"windows file",
     location:"System config"
    },
   },
   uk:{
    "23438ufsdjh8":{
     id:"01",
     name:"windows",
     location:"System"
    },
  }
   
 },
 hardware:{
  ja:{
   "9058t05":{
     no:"ct-01",
     refrence:"down-tPO-01"
    }
  }
 }
};


let Array=[{
  filepath:"print"
 },
 {
  filepath:"hardware"
 },
 {
  filepath:"stack"
 },
 {
  filepath:"backupdir"
 },
];

let cont = {
  "45434dsdfsfv": {
    name: "us",
  },
  "4wer23434": {
    name: "uk",
  },
  "6vfkn23421": {
    name: "ja",
  },
  "9dnfjkn23e": {
    name: "ru",
  },
};


Object.values(cont).map((i) =>{
for (const [key, values] of Object.entries(obj)) {
            for (const [localeKey, localeValues] of Object.entries(values)) {
              console.log(localeValues);
             // fs.writeFile(path.join(__dirname,file.filepath,`${i.name}.json`), JSON.stringify(localeValues, null, 4)
            }
          }
});

I am trying to fetch key from the obj JSON object and compare it with the Array filepath so I can push the value in created json file

here by using fs I am trying to create folder which I got from the array

fs.writeFile(path.join(__dirname,file.filepath,`${cont.name}.json`));

by which I created folder and file with the name which are present inside the cont json
and trying to put like this

print/us.json

{
   "2343192u4":{
     id:"01",
     name:"linux file",
     location:"System config"
    },
   "23438ufsdjh8":{
     id:"02",
     name:"windows file",
     location:"System config"
   }
 }

print/uk.json

{
  "23438ufsdjh8":{
     id:"01",
     name:"windows",
     location:"System"
    },
}

hardware/ja.json

{
  "9058t05":{
     no:"ct-01",
     refrence:"down-tPO-01"
    }
}

and so on …

but the problem is when I do this I am not able to save data in there respective json file
I am getting same output in every json file

print/us.json

{
   "2343192u4":{
     id:"01",
     name:"linux file",
     location:"System config"
    },
   "23438ufsdjh8":{
     id:"02",
     name:"windows file",
     location:"System config"
   }
 }

print/uk.json

{
   "2343192u4":{
     id:"01",
     name:"linux file",
     location:"System config"
    },
   "23438ufsdjh8":{
     id:"02",
     name:"windows file",
     location:"System config"
   }
 }

and so on …

here print hardware stack backupdir always get changed and there are multiple more files as this is system random generated name that why I have to compare and the key from object and make a directory of this name

how can I push them in different different folder with there respective value