Is it wrong to discover the factors using EFA and then do CFA for compartive purpose on the same data set? I have initially done EFA to extract the factors then conducted CFA to confirm those factors and secondly for the comparative purpose. Example factors that were extracted through EFA were further used from the comparative purpose.. The sample size of 500 was split into two parts, 250 each between private and government school for comparative purpose based on the regression value derived through CFA. Both EFA and CFA was done on the same data set. 
 A: Welcome to CV, Sunita. 
Generally speaking, yes, this would be an ill-advised approach. You can think of EFA as a data-driven theory-building approach, and CFA as a researcher-decision-driven theory-testing approach. In essence, running both analyses on the same sample of data would be akin to asking "What do the data tell me the latent structure looks like...?" [EFA] then to conclude, "A-ha! Just as I thought! The latent structure looks just like what the data told me!" [CFA]. In other words, the CFA in this instance is not particularly informative (see our paper, Sakaluk & Fisher, 2016 if you want more of an elaborated version of this [and related] arguments, though note while we think this is the typical way "confirmatory" is understood/meant now, this was not the original meaning of the term when it was introduced to the factor analysis literature) 
One approach that is somewhat common is for researchers to randomly split their sample when they have a sufficiently large data set: one sample for EFA, and another for CFA. This way, the test of the adequacy of the measurement model is conducted on a distinct subset of data than that which informed the initial measurement model. However, it sounds as though you already ran (or want to run) both analyses on the very same data, which limits the informativeness of the CFA in the ways I've described. 
One thing I would consider asking yourself is: why is it important for you to conduct a CFA at this stage of research? You can still use the outputs of EFA in subsequent analyses like regression (or exploratory structural equation modeling, if you want to keep these analyses in "latent space", see Asparouhov & Muthén, 2009). Likewise, you can get indexes of model fit for exploratory models like EFAs (see Fabrigar et al., 1999, or Fabrigar & Wegener's 201 book) and ESEMs if that's what motivated you to attempt the CFA. Depending on your software options, this is included either as standardized output (many R packages, Mplus, SAS), or you can use some freely available resources to calculate them from standard output (e.g., from SPSS). If it's helpful, I can link to those resources if that's the situation you find yourself in. 
References
Asparouhov, T., & Muthén, B. (2009). Exploratory structural equation modeling. Structural Equation Modeling, 16(3), 397-438.
Fabrigar, L. R., Wegener, D. T., MacCallum, R. C., & Strahan, E. J. (1999). Evaluating the use of exploratory factor analysis in psychological research. Psychological Methods, 4(3), 272.
Fabrigar, L. R., & Wegener, D. T. (2011). Exploratory factor analysis. Oxford University Press.
Sakaluk, J. K., & Fisher, A. N. (2019). Measurement memo I: Updated practices in psychological measurement for sexual scientists. The Canadian Journal of Human Sexuality, 28(2), 84-92. (OA preprint: https://psyarxiv.com/tb62k/)
