Don't worry, Berlin is one of the easiest airports to use, IMO, whereas Frankfurt is considered a nightmare by most. If your plane arrives on time, it will be a little tight, but shouldn't be anything to worry about.
If your trip was booked from JFK-KRK, and not as two separate bookings (JFK-TXL and TXL-KRK), then it's all on one ticket, and AB can check any bags all the way through to KRK (ask them for priority tags at JFK if possible).
Your flight will arrive from JFK in the A terminal (almost certainly gates A01 or A02). Each gate has its own immigration facilities. As there are only a few immigration agents assigned to each gate, it helps to be off the plane as soon as possible so you can get to the front of the line. You will then walk past baggage claim and clear customs, which is maybe a 50 yard walk to get into the terminal.
Your flight to KRK will depart from the C gates, which is a 5 minute walk. Security is relatively quick in terminal C, although AB does stack a bunch of flights at around 8:30, so you may have to wait a bit, but I would say no more than 15-20 minutes.
Are you flying coach or business?