Try this :
const Sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(`YourSheetName`)
function dataHandler() {
const dataRange = Sheet.getDataRange()
.offset(1, 0)
const data = dataRange.getValues()
const newValues = data.flatMap(([ name, location, addresses, phone]) => {
const addressList = addresses.split(`\n`)
return location.split(`\n`)
.map((item, index) => {
return [
name,
(addressList[index]) ? addressList[index] : ``,
item,
phone
]
})
})
dataRange.clearContent()
Sheet.getRange(2, 1, newValues.length, newValues[0].length)
.setValues(newValues)
}