Select max value from many to many tables
The question would have been a better candidate for stackoverflow.

Anyways, the problem with your SQL is that the GROUP BY should only be on the author name and not on author name + book title.

From the GROUP BY on author name, get the max(number_of_pages) and wrap it inside another SELECT to to get the books by that author that have that those number of pages.

You would also have to consider the possibility that multiple books can have the same number of pages and if that should result in all of them being returned or just 1.