You can vectorize this easily for huge computational savings:
A = zeros(10000,10000);
for k = 1:10000
for j = 1:10000
A(k+l-1,j+h-1) = A(k+l-1,j+h-1) *exp(+1i*X);
N = 10000;
m = 10;
nX = N/m;
XX = pi*rand(nX);
x = ((1:N).'-N/2).^2;
A = E0*exp(-10^(-6.5)*(x+x.'));
krX = kron(exp(1i*XX),ones(m));
A = A.*krX;
which yields output on my machine:
Elapsed time is 11.358504 seconds.
Elapsed time is 0.577795 seconds.
By the way, I did the vectorization assuming that using 9990 as the upper bounds for k and j in your second loop structure was an error on your part. With how you did it, the bottom-right 10x10 block of A wouldn't be mutiplied by a random number. If you wanted it to be, you should instead use 9991 (or really any number from 9991 up to 10000) as the upper limits. If, on the other hand, how you had it was how you wanted, then immediately after the line where XX is defined in the vectorization code, you should do XX(nX,nX)=0.