how to set default all hotkey in mac
You obviously mean: How do I do this with Karabiner Elements … ?!?

For one: "Cmd-W" is not default for closing apps, but "Cmd-Q" is.

But, if you really want "Cmd-W" to close an app, here is Karabiner Elements' code:

{ "title": "Make ''Cmd-W'' close the current app.",
  "rules": [
     { "description": "Makes ''Cmd-W'' the shortcut for closing apps.",
       "manipulators": [
        { "from": { "key_code": "w",
                    "modifiers": {
                        "mandatory": ["left_command"] }
                  },
            "to":[
                 { "key_code": "q",
                   "modifiers": ["left_command"],
                   "repeat": false }],
          "type":  "basic"
                }  
            ]
        }
    ]    
}


Copy code to BBEdit (TextEdit) and save to ~/.config./karabiner/assets/complex_modifications as WhateverYouLike.json  

Next open KE, tab "Complex Modifications", click [+ Add rule] at bottom, scroll down to WhateverYouLike.json and click [+ Enable].

That should be it … KE's modifications work without restart.

(Btw: the "repeat" part makes your shortcut close only ONE app, just to make sure …)