You don't need "the" before school, so it should say:
I walk with my friend to school every day. NOTE: This means that you and your friend both go to the same school and you walk there together. If you do not attend that school and walk along with your friend just to keep them company or because they're afraid to walk alone, then you would say "I walk my friend to school every day." This implies that once you get to the school building, your friend goes inside and you return home or go elsewhere.
b) I had nothing to do, so I walk with them to this classroom.