You should use get_post_class()
From Codex:
get_post_class()
is not simply a non-echoing alternative to
post_class()
.get_post_class()
does not return a string, but an array
that must be processed to produce text similar to what is echoed by
post_class()
.
So
$classes = get_post_class();
$output="<div id="" . get_the_ID() . '" class="' . implode(" ", $classes) . '"></div>';