How to create LineSegments in which to be fitted in a mesh

please guys i wanna help ,

let’s say i have a mesh like this

and i want to create line segments to be fitted within the mesh faces i.e i want to convert the mesh to lines like this

anyone can help please ???