Make the
updateData function asynchronous.
Something like this (untested):
async updateData(param1, param2){
let data = await chrome.storage.local.get('mykey') ;
data = data + param1 + param2 ;
await chrome.storage.local.set({ mykey: data }) ;
}
Then, you must use the function like this:
(async ()=>{ //a self executing asynchronous function so that we can use the await operator in it
if(value == "start")
await updateData("A", "B");
if(value == "mid")
await updateData("M", "N");
if(value == "last")
await updateData("X", "Y");