Clear["`*"]

a=4;
lots=1000;(*This is for later*)

f[x_]:= a*x*(1-x)

s2=Plot[{f[x],x},{x,-.1,1.1}];

(*Here is the main sequence for the cobwebbing*)
mmm[x_,n_]:=ArrayFlatten[Table[{{Nest[f,x,i],Nest[f,x,i+1]},{Nest[f,x,i+1],Nest[f,x,i+1]}},{i,0,n}],1]

(*Need to add the initial point - would be good to make this in just one step but somehow Mathematica didn't like that*)
m[x_,n_]:=PrependTo[mmm[x,n],{x,0}]

cobweb[x_,n_]:=Line[m[x,n]]

(*Here is the finished product *)
x0=RandomReal[];
max=500;
Manipulate[Show[{s2,Graphics[cobweb[x0,top]]}],{top,0,max,1}]

vv=NestList[f,RandomReal[],lots];
ww=Table[vv[[i]],{i,lots-100,lots}];

ListPlot[vv]
ListPlot[ww]