Windows 10: Windows Update Error or Loop

Download and install the Windows Update Troubleshooter from Microsoft that will fix your Windows Update issues:

https://support.microsoft.com/en-ph/help/4027322/windows-windows-update-troubleshooter

If that fails, you can always delete the downloaded files and start over.

(From Microsoft):

Whenever Windows updates website scans and install any updates or patches, it gets stored on the below location.
%windir%\softwaredistribution\download

Depending upon the updates different folders gets created on the above location.

For clearing the contents of the softwaredistribution folder, try the below commands on the command prompt.

net stop wuauserv
rmdir %windir%\softwaredistribution  /s /q
net start wuauserv

exit