Deleting all the matching items in single linked list
Several issues jump in the eyes:


very complicated logic
very strange "removal" logic: copy value from next node + delete next node
is recommended to use braces even on single statement if-else
messy indentation


This can be done a lot simpler, by using a dummy node:

ListNode dummy = new ListNode();
dummy.next = head;

ListNode runner = dummy;
while (runner.next != null)
{
    if (runner.next.val == val)
    {
        runner.next = runner.next.next;
    }
    else
    {
        runner = runner.next;
    }
}

return dummy.next;