I have no idea why you need to use NDsolve for as there is no differential equations here. And no body uses loops in Mathematica :) Use FindRoot to find the root and then plot the function z[x]. I used x as the guess where to start root search from when solving for y in BesselJ[1, x] == BesselJ[0, y] since one has to pick a point. Fee free to change this if you think there should be a better guess to use.
f[x_?NumericQ]:= Module[{y},y /.FindRoot[BesselJ[1, x] == BesselJ[0, y],{y, x}]];
const = 1;
z[x_] := f[x] + const*x
ListLinePlot[Table[{x, z[x]}, {x, 0.1, 10, .5}], Frame -> True, Mesh -> All,
PlotStyle -> {Red, PointSize[.02]},
FrameLabel -> {{"z[x]", None}, {x, "z[x] vs. x"}}, GridLines -> Automatic,
GridLinesStyle -> LightGray]

Plot[{BesselJ[1, x], BesselJ[0, x]}, {x, 0, 10},
PlotLegends -> {"BesselJ[1,x]", "BesselJ[0,x]"}]
