Did you work in MA in 2023? MA can tax you as non-resident on income earned from working within Massachusetts, or on any other MA-source income (such as rental income from property located in MA).
But if you have no MA-source income, then you must file a non-resident MA return, showing zero MA income, in order to obtain a refund of the incorrectly withheld MA taxes.
You cannot automatically apply one state's refund to another state's tax bill. You must obtain the refund and then pay the other state yourself. ALL your 2023 income is of course taxable by your new home state of CT, regardless of where you earned it.
**Answers are correct to the best of my ability but do not constitute tax or legal advice.