One simple way to do it is to keep 2 datetime variables, one called OldDate and one called NewDate.
In a try-catch, try assign NewDate = (fill in with existing code, either parseexact(), or cdate()
catch system.exception assign NewDate = OldDate
then at the end of the loop, assign OldDate = NewDate.
This way the new date will be found by converting the string. If there is an error converting the string (generally because it’s empty) then it will use the previously used date. At the end of the loop, it will change the OldDate variable to the newest date you’ve used.
A better way to do this would be using the DateTime.TryParseExact method, but the various .TryParseExact methods are kind of hard to work with in UiPath in my opinion, and my solution above accomplishes the same thing.