not outputting medium size image URL

Just use the the_post_thumbnail() function. It creates the image tag, adds srcset for you, and supports native lazy loading:

the_post_thumbnail( 'medium', [ 'class' => 'productimage' ] );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)