In this paper, we study the rotation curves of the Milky Way galaxy and Andromeda galaxy (M31) by considering their bulge, disk, and halo components. We model the bulge region by the widely accepted de Vaucouleur's law and the disk region by the well established exponential profile. In order to understand the distribution of dark matter in the halo region, we consider three different dark matter profiles in the framework of the standard ΛCDM model namely, Navarro-Frenk-White (NFW), Hernquist and Einasto profiles. We use recent data sets of rotation curves of the Milky Way and Andromeda galaxy. The data consist of rotation velocities of the stars and gas in the galaxy as a function of the radial distance from the center. Using Bayesian statistics, we perform an overall fit including all the components, i.e., bulge, disk and halo with the data. Our results indicate that the NFW and Hernquist profiles are in concordance with the observational data points. However, the Einasto profile poorly explains the behavior of dark matter in both the galaxies.