Remove the echo. In PHP, you only use echo when you want to send the result as text to the browser. If you want to use the value in PHP (like you are trying to do), then you leave out the echo and add $post->ID, ‘meta_field_you_want’, true to get_post_meta();