The attorney general is asking the court to order the towns to create a zoning district that complies with a 2021 law intended to boost housing production near MBTA stations.