α=.5;
Δx=.1;
Δt=.01;
l=-5;
r=5;
ϵ=10^-5;

λ=((α*Δt)/(Δx^2));
n=(r-l)/Δx+1;
axis=Table[l+(i-1)*Δx,{i,1,n}];
a=SparseArray[{i_,j_}/;j-1≤i≤j+1->λ,{n,n},0]+(1-3λ)*IdentityMatrix[Floor[n]];
u=Table[20,{i,1,n}];
u[[1]]=0;
u[[n]]=0;
record={u};
ListLinePlot[Table[{axis[[i]],u[[i]]},{i,1,n}],PlotRange->{{-5,5},{0,20}}]

DynamicModule[{go=True},
Monitor[While[go,
u=a.u;
u[[1]]=0;
u[[n]]=0;
record=Append[record,u];
p=ArrayPlot[{u/20,u/20},ImageSize->Full,ColorFunction->(ColorData["RustTones"]),ColorFunctionScaling->False];
q=ListLinePlot[Table[{axis[[i]],u[[i]]},{i,1,n}],PlotRange->{{-5,5},{0,20}},ImageSize->Large];
],EventHandler[
GraphicsColumn[{q,p}],{"MouseClicked":>(go=False)}]]
];
GraphicsColumn[{q,p}]