Creating walls relative to another part?

I have paths and I am trying to create walls with some math, however, the orientation seems to be messing it up or something, when I move the part 2 axis’ are changing.

They are both inside of each other:

local path = Instance.new("Part")
			path.Size = Vector3.new(1, thickness, distance)
			path.CFrame = CFrame.lookAt(midPosition, p1, Vector3.new(0, 0, 1))
			path.Anchored = true

			local right_wall = Instance.new("Part")
			right_wall.Size = Vector3.new(1, thickness, distance)
			right_wall.CFrame = CFrame.new(path.CFrame.X, path.CFrame.Y + (path.CFrame.Y/2), path.CFrame.Z)
			right_wall.Anchored = true
			right_wall.Orientation = Vector3.new(0, path.Orientation.Y, 0)
			right_wall.Parent = path

			local left_wall = Instance.new("Part")
			left_wall.Size = Vector3.new(1, thickness, distance)
			left_wall.CFrame = CFrame.new(path.CFrame.X, path.CFrame.Y - (path.CFrame.Y/2), path.CFrame.Z)
			left_wall.Anchored = true
			left_wall.Orientation = Vector3.new(0, path.Orientation.Y, 0)
			left_wall.Parent = path

			path.Parent = workspace

Can you describe in detail how these walls should be positioned? What is path and which of its axes are aligned to which directions of the wall?

Firstly I edited my code block to add more context, I want them to be positioned like a walkway:

As I move the parts the X and Z axis change