Blender Game Engine python loop issue
I'd suggest if  you are going to use global variables, then run script as a module, otherwise would need set up Boolean properties on object and use them to keep tabs on U, D, L, R. 



Slight change to code, the controller is automatically passed to the module, which needs to have the .py extension.

import bge
U = False
D = False
L = False
R = False
def main(cont):
    global U
    global D
    global L
    global R

    own = cont.owner

    keyboard = bge.logic.keyboard

    wKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.WKEY]
    sKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.SKEY]
    aKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.AKEY]
    dKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.DKEY]

    if wKey and (D == False): 
        U = True
        D = False
        L = False
        R = False
    elif sKey and (U == False): 
        U = False
        D = True
        L = False
        R = False
    elif aKey and (R == False): 
        U = False
        D = False
        L = True
        R = False
    elif dKey and (L == False): 
        U = False
        D = False
        L = False
        R = True
    # test print 
    print(U, D, L, R)
    if U:
        own.applyMovement([0,0.2,0],True)
    if D:
        own.applyMovement([0,-0.2,0],True)
    if L:
        own.applyMovement([-0.2,0,0],True)
    if R:
        own.applyMovement([0.2,0,0],True)