I am an ectomorph of 23 years age. My weight is 55 kg and height is 5'7. I have been told to take mass gainer (Contains mostly fats) by my gym instructor. But I have to build muscles which requires protein. So can anybody want to throw some insight on this?
You are not an ectomorph. There is no such thing as an ectomorph, as the concept of somatotypes is a nonsense pseudoscience that was made up in the 1940s and has never been supported by evidence.
What you are, at 5'7" and 55kg, is very skinny. If you eat more without exercising, you'll get fat, and if you eat more and add a sufficient intensity and volume of strength training, then you'll become muscular, same as anyone else.
The mass gainer may work for you, but it's a lazy suggestion by your trainer. The far better method would be to track all of the food that you're eating with a calorie counting app, and set calorie and protein targets for each day, making sure that you eat enough food to reach these targets. If you do decide to take the mass gainer, just make sure that you are taking it in addition to what you would normally eat. Do not use it as a meal replacement.
I'd recommend also reading this other answer of mine on how to gain muscle as a skinny person: How long would it take for a skinny man to get fit and 6 pack?