What is wrong with the overpass query

trying to get administrative hierarchy data, it doesn’t show any output.

[out:xml][timeout:5000];why it doesn’t show any output,

// Define the area for India
{{geocodeArea:India}}->.indiaArea;

// Fetch all state relations within India (admin_level=4)
rel(area.indiaArea)[“admin_level”=“4”][“boundary”=“administrative”]->.states;

// Iterate over each state to fetch admin levels 4, 5, and 6 boundaries
foreach .states → .state {
// Get the name of the state for reference
//.state out tags;

// Fetch administrative boundaries of admin levels 4, 5, and 6 within the state
(
rel(pivot.state)[“boundary”=“administrative”][“admin_level”=“5”];
rel(pivot.state)[“boundary”=“administrative”][“admin_level”=“6”];
) → .admin_boundaries;

// Output the fetched data
.admin_boundaries out meta ids tags;
}

I am not an expert for „pivot“, „foreach“,…

But you try to get too much data in your query.

For level=5,6 boundaries in a state you can use this query:

A. Please directly use https://osm-boundaries.com/ to retrieve, instead of querying from Overpass unless you have special requirements that can’t be postproccessed
B. You don’t need the foreach loop if they don’t have to be in exact order in the returned data. And do you need the XML for editing OSM?

[out:json][timeout:55]; 
{{geocodeArea:India}}->.ar;
rel(area.ar)[boundary=administrative][admin_level~"4|5|6"]; 
out geom meta;