Setting A Value With a Console Command

How would I set a players level with a console command by simply type set_lvl <name> <number> in console? I tried using this from another code but it didn’t work.
[lua]
– Start Save
function SaveDataNPC(npc, killer, weapon)
if npc:IsNPC() and killer:IsPlayer() then
file.Write(“exp/”…killer:UniqueID()…"_exppoints.txt", killer:GetNWInt(“EXP”))
file.Write(“exp/”…killer:UniqueID()…"_level.txt", killer:GetNWInt(“Level”))
file.Write(“exp/”…killer:UniqueID()…"_skillpoints.txt", killer:GetNWInt(“SkillPoints”))
end
end
hook.Add( “OnNPCKilled”, “SaveDataNPC”, SaveDataNPC )

function SaveDataPlayer(victim, weapon, killer)
if victim:IsPlayer() and killer:IsPlayer() then
file.Write(“exp/”…killer:UniqueID()…"_exppoints.txt", killer:GetNWInt(“EXP”))
file.Write(“exp/”…killer:UniqueID()…"_level.txt", killer:GetNWInt(“Level”))
file.Write(“exp/”…killer:UniqueID()…"_skillpoints.txt", killer:GetNWInt(“SkillPoints”))
end
end
hook.Add( “PlayerDeath”, “SaveDataPlayer”, SaveDataPlayer )
– End Save

local chatcommands = {}

// Allow admins to change the exp level of players
concommand.Add(“exp_setlevel”,function(ply,cmd,args)
if ply:IsAdmin() then
leveln = tonumber(args[2])

	local tar
	for _,v in ipairs(player.GetAll()) do if string.match(v:Name(),args[1]) then tar = v end end
	
	if not tar then ply:ChatPrint("Please use a valid target! (format &lt;player name&gt; &lt;level&gt;") return end
	if leveln &lt; 1 or leveln &gt; 100 .. ".") return end
	tar:SetNWInt("Level",leveln)
	
	ply:ChatPrint("You set "..tar:Name().."'s level to "..Leveln..".")
else ply:ChatPrint("You must be an admin to use this command.") end

end)
table.insert(chatcommands,{“setlevel”,“exp_setlevel <player name> <level number>”,“Set a player’s experience level”,true})
[/lua]

I think [lua]if leveln < 1 or leveln > 100 … “.”) return end[/lua] at line 35 should be [lua]if leveln < 1 or leveln > 100 then return end[/lua]

That’s true but doesn’t quite answer my question.