You should do it by hooking in to the login_form
action, rather than modifying wp-login.php, which will get overwritten at next update.
You can add this code to your theme's functions.php
file:
// As part of WP login form construction, call our function
add_filter ( 'login_form', 'login_form_prepop' );
function login_form_prepop(){
// Output jQuery to pre-fill the box
if ( isset( $_REQUEST['myusername'] ) ) { // Make sure a username was passed
?>
<!-- Small jQuery script to set the value of the input field to your variable -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready( function(){
$("#user_login").val( '<?php echo( $_REQUEST['myusername'] ); ?>' );
});
</script>
<?php
}
}
Then update your code to include the variable:
<?
if (!is_user_logged_in()): ?>
<meta http-equiv="refresh" content="0;URL=<? echo wp_login_url(get_permalink()); ?>?myusername=username">
<? endif; ?>
If the jQuery footprint is too much, you can achieve the same with JavaScript:
<script type="text/javascript">
var el = document.getElementById("user_login");
el.value = "<?php echo( $_REQUEST['myusername'] ); ?>";
</script>