do you want to append href inside the file test.aspx?
declare @var char(10)
select @var=name from Filenames where name like '%.aspx' --sample query
-- now @var holds the value 'test.aspx'
-- this does not work if the query returns more than one value
declare @qry char(100)
set @qry = 'echo "href" >> '+@var
xp_cmdshell @qry