To find out why Montag takes the books, we have to wait until we see what he does with them. As it turns out, he hides the book in the other fireman's house while he is on his way to Faber's house. We can infer, then, that Montag stopped to pick up the books so he could do that to Black (the other fireman).
But why would he want to? The point is to discredit the whole society. He had had this idea before, that putting books in the homes of firemen would make the firemen look bad and eat away at the whole system in this society. Now he's trying to do that.
So, his purpose in doing this is to try to do one more thing to weaken the society that he has come to hate.
After Montag kills Captain Beatty, he returns home to retrieve the books that he hid near the fence of his garden. Mildred had forgotten to burn all of the books, and four still remained. Shortly after retrieving the books, Montag sneaks into Black's home and plants the books in his kitchen. Montag then calls in an alarm on his fellow fireman to distract the authorities that are chasing him. This diversion is successful, and Montag ends up escaping to Faber's home for a short time. The Mechanical Hound heads towards Black's home instead of following Montag. When Montag left the four books in Black's kitchen, he initially felt guilty. However, the diversion ends up saving Montag's life. At Faber's home, Montag watches on a small television as the Mechanical Hound captures an innocent man.