Solution 1:

Move a file from MyDrive to Shared Drive

function movefileToSharedDrive() {
  const file = DriveApp.getFileById('');//fileid
  const fldr = DriveApp.getFolderById('');//shared drive id
  Drive.Files.update({"parents": [{"id": fldr.getId()}]}, file.getId(), null, {"supportsAllDrives":true});
}

Drive API Version 2 needs to be enabled