How do I fix my munmap_chunk(): invalid pointer error? It is being printed after my intended output?