here's a basic test case script that will replace placeholder items in Layer 1, with source items in Layer 0 (top layer)
set up you test file like this

the script will match each Layer 1 placeholder item's size and position to each Layer 0 source item, then it will remove the placeholder item
result

// replace placeholder items
// place source items in layer 0
// place placeholder items in layer 1
function main() {
var idoc = app.activeDocument;
var sourceLayer = idoc.layers[0];
// if first layer is empty, then skip
if (sourceLayer.pageItems.length > 0) {
var sourceItems = sourceLayer.pageItems;
var sourcecount = sourceItems.length;
var placeholderLayer = idoc.layers[1];
var placeholderItems = placeholderLayer.pageItems;
for (var a=sourceItems.length-1; a>=0; a--){
sourceItems[a].width = placeholderItems[a].width;
sourceItems[a].height = placeholderItems[a].height;
sourceItems[a].position = placeholderItems[a].position;
sourceItems[a].move(placeholderLayer, ElementPlacement.PLACEATEND);
}
// REMOVE PREVIOUS PLACEHOLDER ITEMS
for (var b=0; b<sourcecount; b++) {
placeholderLayer.pageItems[0].remove();
}
}
}
main();