You could use add_shortcode if you want to use it within the editor.
function footag_func() {
return "Test";
}
add_shortcode( 'footag', 'footag_func' );
And then use [footag] in your editor.
Or
Use code like this in functions.php and add a conditional tag
add_action( 'loop_start', 'your_function' );
function your_function() {
if ( is_singular('post') ) {
echo 'Test';
}
}
or
Create a function in functions.php
function your_function() {
return 'Test';
}
And then use this in your template
echo your_function();