kutup sounds like the plural of kitap in arabic :)
That's not a coincidence! The Turkish word is a borrowing from Persian which is built of the Arabic for "books"and the Persian word for "house".
Is it incorrect to translate this as "they are lonely in the library"?
"Yalnız" in this sentence can also mean "but, though, still". Hence, the sentence as a whole also has another meaning to it, which is "They are in the library, though". And this is mostly the case.
İt means they as a group are alone in the library, maybe referring to library staff not being present or any other students, İ assume
I think it could translate better to 'they were on their own in the library'