The problem is that the point data is being written in ascii though it should be in binary. As mentioned in the previous solution, you could change the kernel. But in my case i needed the Exact_predicates_exact_constructions_kernel. So, to solve the issue, I just changed the output format to ascii.
CGAL::IO::write_PLY("file_name.ply", mesh,CGAL::parameters::use_binary_mode(false));