If you are facing this problem you can esily solve this issue via adding following code.
Put this function call where your shortcode functions starts.
ob_start();
And
Befor ending of the shortcode function add this calling function
return ob_get_clean();
Here is the example how to do.
<?php function textshortcode($atts, $content = null)
{ ob_start(); ?>
<div style=”width:100%; position: sticky; z-index”>
<div style=”width:100%; height:7px; background-color:#f6be16;”></div>
<form method=”post” name=”form1″ action=”http://adityainfo.co.in/search-page/”>
<div class=”search-wrapper”><div class=”search-inner”>
<div class=”search-col”>
<p class=”search-title”>Machinery Search</p>
</div>—- code here —-
</form>
</div>
<?php return ob_get_clean(); } ?>
add_shortcode(‘textshort’, ‘textshortcode’);
this is how you can put shortcode where you want.