Assigning different physical groups to different color in gmsh and mark them as different material in fenics

@howstheJosh Thanks for the reply, I referred to Gmsh, Meshio, Dolfin suggested by @dokken and therefore wrote the condition for facets, I tried replacing what you suggested but still the error persists.
Modified Code:

import meshio

msh = meshio.read("/mnt/d/Research Projects/FEM for microstructures/sample1.msh")

meshio.write("mesh.xdmf",
    meshio.Mesh(points=msh.points,
        cells={"triangle": msh.cells_dict["triangle"]},
    )
)

meshio.write("mf.xdmf", meshio.Mesh(points=msh.points[:,:2], cells={"line": msh.cells_dict["line"]}))

from dolfin import * 

mesh = Mesh()
with XDMFFile("mesh.xdmf") as infile:
    infile.read(mesh)

mvc = MeshValueCollection("size_t", mesh, 1) 
with XDMFFile("mf.xdmf") as infile:
    infile.read(mvc, "line")
mf = cpp.mesh.MeshFunctionSizet(mesh, mvc)

plot(mesh)

Error:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/tmp/ipykernel_28/1003279362.py in <module>
     19 mvc = MeshValueCollection("size_t", mesh, 1)
     20 with XDMFFile("mf.xdmf") as infile:
---> 21     infile.read(mvc, "line")
     22 mf = cpp.mesh.MeshFunctionSizet(mesh, mvc)
     23 

RuntimeError: 

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to recognise cell type.
*** Reason:  Unknown value "".
*** Where:   This error was encountered inside XDMFFile.cpp.
*** Process: 0
*** 
*** DOLFIN version: 2019.2.0.dev0
*** Git changeset:  ubuntu
*** -------------------------------------------------------------------------

Can you please tell me what can be the possible source for this error which I could change ?
Thank You
PS: Since I am only using a plane surface and meshed it and via post processing I added image on this plane surface (kindly see the above post from where I have posed the question), I am just using mesh without any info stored in it about facet_tags or different material properties, I did that using defining different material properties at the midpoint of the cell via a .dat file which contains each point material propery, but the results are not showing in the paraview.