You've pretty much hit the nail on the head.
You already use libraries in coding if you're working in any reasonable language. In C/C++, as soon as you #include anything, that's a library. In Python, as soon as you import anything, that's a library. If you code, you've probably written your own library, although possibly nothing as grand as, say, TDL or Boost. It's just another way of defining a group of commonly used functions and variables.
Effectively, a library is a set of related, commonly used code that prevents you having to write similar code from scratch (in some cases, this could take weeks, months, or even years to do) and allows you to get on with the nitty gritty of coding.