So, what you need to do is iterate over the factbase and, for each entry in it, extract two elements, and then incorporate those two elements into text output that you send to the screen.
For the second bit, look into print and format; the latter is particularly good for this kind of thing.
For iterating over the factbase, you need to know what kind of collection you've stored the facts in, and how to iterate over it. Is it a list, a hashmap, a vector, or something else?
For extracting the elements, that depends entirely on what kind of a thing you've stored them in. Again, are you using lists, hashmaps, objects, structs..?