change position of element using hook [closed]

Instead of adding and removing the hooks like this.
You should do the work on some action/hook. which gets fire before these hooks.

so you can call it in this way

add_action( 'init' , 'sf_change_header_position' , 10 );
function sf_change_header_position() {
   remove_action( 'storefront_header', 'storefront_secondary_navigation', 30 );
   add_action( 'storefront_header', 'storefront_secondary_navigation', 52 );
}