Please confirm whether you want the traditional canonical 18 Shaktipeeths that include sites outside India (e.g., Hinglaj in present-day Pakistan) or only Shaktipeeths located within India. This choice changes route, visa/border needs and the 40-day feasibility.
You asked for 'budget range' and 'overnight trains' — please confirm preferred train class (Sleeper SL, 3AC) and accommodation style (basic budget guesthouses / budget hotels). I will use Sleeper/2nd class or 3AC and budget hotels/guesthouses by default if you don't specify.
After you confirm the above two points I will produce the full 40-day day-by-day itinerary (each day: temple darshan with opening times, overnight train leg details, and breakfast/lunch/dinner recommendations timed to temple hours).