Add function to append n bytes

This adds a function to add the first N bytes from a string into a buffer.
lol why print to stdout?