Hi, Welcome to Health care magic forum.
Being 27, 168 cm height, if you are 40 kg, it may be due to some chronic disease like
tuberculosis. Or it may be due to genetic factor if majority of your family members are very thin.
Still you can try to over come it. I advise you to consult a physician for diagnosis.
I usually prescribe to my patient with such requirement,injections of anabolic
steroids periodically,
protein supplements, multivitamins.
Take plenty of calories, fats, fries,and sweets.
Sleep for more time, and try to sleep during day for some time.
Take more of green leafy vegetables, pulses, sprouts, and protein rich foods.
Wishing for a quick and complete recovery. Thank you.