How to write function in sql which accept table as input and return result back as table?
You cannot include a table declaration in the stored procedure declaration.
If you really want to pass rows of data, create a table-valued parameter type, then use it in your stored procedure.

How about a simpler table valued function, that calculates product and quotient of 2 integers:

CREATE FUNCTION fn_CalcProductQuotient(
@Value1 INT,
@Value2 INT)
RETURNS TABLE
AS
RETURN (
SELECT @Value1 * @Value2 AS [Product]
       ,@Value1 / @Value2 AS [Quotient]
);


Make sure to use an inline user-defined function. This way the plan optimiser can parallelise your plan (if you have multiple cores) and you will get much better performance.

You can use this function as following:

SELECT  [RowID]
       ,[Value1]
       ,[Value2]
       ,Calc.[Product]
       ,Calc.[Quotient]
FROM Items i
CROSS APPLY fn_CalcProductQuotient(Value1, Value2) Calc