the two loops are fine. But you are making the logic a bit more complicated.
Define a variable ex. largest which will hold the largest value in each iteration. and will be added to the new array every time we find the largest value in each array,
Initially largest is the first value of each array so lets compare and replace it. something like this if(current value > largest) then update the largest with the current value.
This way you will find the largest value of that array
then add the largest value to the new array on each outer loop interation.
rest is upto you. Take some time to understand.
[and don’t return a console.log statement; just return ;]