Saving a value of a plugin into text file

I’m modifying a plugin for automatic analysis of thousands of images. All I need is a single value the plugin produces, and now my plugin prints out the value as a popup window. But I think it has to be printed out as a table just like the result image pops up as a separate window, so that it can be saved using macro. Or is it possible to save the result table and the image directly within the plugin? What kind of methods or classes I can use in this case?