Saving an item from a repeater into another Database

I have a repeater displaying items from a Dataset

I would like to click a button to save all these items one by one into another database and then delete the item from the current database

I am using the following code but I cannot figure out how to save the items in another database

export function send_click(event, $w) {
 let dataset = $w("#dataset1"); // or the name of your dataset
        dataset.onReady(async() => {
 while (dataset.getCurrentItem()) {
 await dataset.save();
            }
        });
        dataset.onReady(async() => {
 while (dataset.getCurrentItem()) {
 await dataset.remove();
        }
        dataset.referesh();
    });
}

The function would be quite similar to a Checkout Button where you click on checkout and the items are emptied from the Cart Database and entered into the Sales Database