Hi Q,
If you are new to the Wolfram Language (WL) I suggest you try not to use "Python style" to write WL code. Rather than transcribing procedural Python code to WL, use a functional approach instead. Here is a functional implementation
f[x_] := x - Exp[-x];
x0 = 0.5;
ϵ = 1.*10^-8;
NestWhileList[(# - f[#]/f'[#]) &, x0, ϵ < Abs[#1 - #2] &, 2]