Greetings, sorry about the pain. Your posture and poor muscle activation have contributed to your pain. What you did was correct but posture needs to be addressed. Until you recover try not to visit gym.
Next Steps
see a physio with knowledge about trigger point and posture correction and you can see results in 2-3 days and after corrective exercise for neck and shoulder as recommended by physio in 2 weeks you can return to gym.
Health Tips
if any issues do let me know