Yeah, the loop will usually produce more output than necessary (since you have to create it in an integral number of blocks), then you throw out the leftovers. The original HKDF algorithm is defined in terms of bits (as those crazy mathematicians are wont to do :-), but everyone agrees that that's stupid and so all the real implementations use whole bytes instead.

So if your function is defined to return a hex string, I think that first line is correct. The test vectors should tell for sure. The second line seems backwards.. I always forget how sjcl codecs work, but I think "output" is already in the "bits" type, so you'll want a fromBits instead of a toBits.