You don't need to have a loop for getting a serial number 1..9999. This can be done without any loop/iteration at all. See below for a sampel code.
CREATE PROCEDURE writeNo
AS
BEGIN
SET NOCOUNT ON
INSERT INTO [dbslno].[dbo].tblslno(slno)
SELECT n
FROM
(
SELECT TOP (9999) n = CONVERT(INT, ROW_NUMBER() OVER (ORDER BY s1.[object_id]))
FROM sys.all_objects AS s1 CROSS JOIN sys.all_objects AS s2
) a
SELECT *
FROM [dbslno].[dbo].tblslno
END
GO
exec writeNo
GO