I assume you are questioning why you get no result at all from your function. That is because you created a function which returns a table, but you didn't populate the table.
You are only returning a single value, you should just use a scalar function.
CREATE OR ALTER FUNCTION dbo.fnBIDouangTest(@SettlementDate DATE,@count int)
RETURNS DATE
AS
BEGIN
--Create Holidays temp table
DECLARE @TblHoliday AS TABLE (Holiday_Date DATE)
INSERT INTO @TblHoliday --(populating holidays from DimDate table)
SELECT
FullDate Holiday_Date
FROM DBO.dimDate d
WHERE d.IsUSCivilHoliday = 'Y'
AND YearNum >= 2019
--Running through the loop twice
DECLARE @FundingDate DATE
DECLARE @i int = 1; -- my "iterator"
WHILE @i <= @count
BEGIN
SET @FundingDate = dateadd(day, -1, @Settlementdate)
WHILE ((SELECT TOP 1 1
FROM @TblHoliday
WHERE Holiday_Date = @FundingDate) = 1 OR datename(dw, @FundingDate) IN ('Saturday', 'Sunday'))
BEGIN
SET @FundingDate = dateadd(day, - 1, @FundingDate)
END
SET @i = @i+1
SET @Settlementdate = @FundingDate
END
RETURN @FundingDate;
END