Variable has written in SendRequest part is not available outside

Hello community. Please help with an issue, I can not understand why it is not working.

I need to create ListofVariables with different metrics. I run each item in categories of the particular request to get detailed data for calculation. But those data I need to use in a separate test, and outside the SendRequest part I can not access the data:

var ListofMetrics = {};
categories.forEach(item => {
    pm.sendRequest("{url}/coins?category=" + item, function (err, response) {
        if (response.code != 200) {
            console.log("An error has occurred. Error object: ");
            console.log(response);
            return;
        }
        else {
            var metrics = {
                avgchange: response.json().data.reduce((partialSum, a) => partialSum + a.ch, 0) / response.json().data.length,
                marketcap: response.json().data.reduce((partialSum, a) => partialSum + a.mc, 0),
                volume: response.json().data.reduce((partialSum, a) => partialSum + a.v, 0)
            };
            ListofMetrics[item] = metrics;
            console.log(ListofMetrics); // I can access dictionary data
        }
    });
});
console.log(ListofMetrics); // second: the output is {}

image

What I should write to access the data of ListofMetrics outside the loop?