There are 3 types of indexes: 1. Price weighted, 2. Equal weighted, and 3. Value weighted. There are flaws in the interpretation of returns with price weighted stock indexes so I will not outline how to construct that type of index.
Equal weighted would be where you calculated the daily returns for each stock in your index, i.e. = (Price today + Dividend - Price yesterday)/(Price yesterday) This is in decimal form. Then you sum the returns for that day for all the stocks that comprise your stock index. Then you divide that sum by the number of stocks in your stock index. Then you repeat that calculation for each day of the time period of your study. If your periodicity is other than daily, e.g. weekly, monthly, quarterly, annual then you do the same procedure with the different period.
Market value weighted takes each daily return of each stock in the index and multiplies it by the market value weight of that stock in the index. First you compute the market value of the stock (Stock price multiplied by the number of common shares). Then you sum all the market values of all the stock in your index. Then you calculate the market value weight of each stock by dividing its market value by the market value of the stock index. You do this for each day, for as long as your time period of the study. Again, you can switch to other periods (weekly, monthly, etc.) as needed.
The list of constituents of NSE ESG index is available. You can bifurcate them into large cap and mid cap. The weights of each company is also given, you have to use the bifurcated list as separate indices.