Is it necessary that there is an underlying cancer in dermatomyositis and poly myosotis? And does the condition vary from person to person or same?

See below. It is only in small minority of people who have underlying malignancy with dermtomyositis/myositis. The symptoms and disease course do vary widely in different people.
No not necessary. The risk is about 25% in Dermatomyositis and 10% in Polymyositis. All patients need to be screened for cancer which can be of nearly any type but breast, lung, colorectal and ovarian cancers are most common.These diseases by themselves are serious and requires I see monitoring.