I think you misunderstand.
Neither solution, using the invoke code nor the write line activity are downloading the log file and neither are grabbing all the log messages, for example neither will capture any error messages thrown.
What they both do is provide a way to log a message that appears both in the output panel and to a custom log file. My stance is that, for such a simple function, using the invoke code method is very cumbersome when you can just use Write Line and a TextWriter Class.
To capture all of the logs there are two choices, one is to make an API call to download the logs for the current job, however you need the Job ID in order to do that which is not easy to expose. Its situationally possible to grab these logs based on other filters, but it will bot be reliable.
The other method involves hooking into the underlying logging class on the robot runner to register your own log listener.
Both of these require advanced knowledge of coding (to get the Job ID or register a listener) and making custom activities in Visual Studio.