Calculating the mass of star I am doing a project which requires that I have data for the mass of several stars. However, the data for mass of stars is obviously not readily available as it's really hard to calculate. In such a scenario, would it be alright to use the mass-luminosity relationship with different values of p(3.5 for a main sequence star) without getting major errors?

Also, what value of p should i use for other stars like white and brown dwarfs?
You don't say what other information you have for the "several stars". Yes, you can use a mass-luminosity relationship if the stars are on the main sequence. In terms of mass uncertainties I would estimate that you might be at the level of 20% unless you can absolutely pinpoint them on a Hertzsprung-Russell diagram, because the luminosity of a (fixed mass) main sequence star changes, even whilst it is on the main sequence.

If the stars are in any other phase of their evolution then your problem is much harder, even if you can place them on the HR diagram. Not least because there is considerable disagreement between different evolutionary models as regards the positions of stars of a given mass at a given age, on both the pre- and post-main sequence. Furthermore, their luminosity and temperature evolution can be influenced by factors such as rotation, metallicity, magnetic fields and mass-loss.

Compact stellar remnants and brown dwarfs do not follow a mass-luminosity relation. In general you can only estimate their masses if they are in binary systems, or for white dwarfs, you can estimate their radii and either their surface gravity or gravitational redshift. Estimating a brown dwarf's mass needs both its luminosity and age.