You're getting error because you're violating SQL function Syntax, See function syntax
HERE[
^] for more.
You can further improve your function like below.
CREATE FUNCTION dbo.hello()
returns bigint
AS
BEGIN
declare @var bigint;
set @var = (select COUNT(*) from TestXML)
return (@var)
END;