The late Pope Francis claimed he saw the devil three times during his lifetime, in extracts from his private diary quoted in a new book.