I think this function works for only intersected boundaries: i used the solution below, and it is working fine.
merge.addEventListener('click',function(){
var updatedGeometry=new Array();
graphicsLayer.graphics.map(function(gra){
updatedGeometry.push(new Polygon((gra.geometry)));
});
var joinedPolygons = geometryEngine.union(updatedGeometry);
graphicsLayer.removeAll();
joinedPolygons.rings.forEach(function(ring)
{
resultpolygon={type:"polygon",rings:[ring]};
var resultgraphic =new Graphic({
geometry: resultpolygon,
symbol: resultsymbol
});
graphicsLayer.add(resultgraphic);
// console.log(ring);
});
});